Subject |
Re: Closing an image on a form |
From |
royprice <royprice@royprice.name> |
Date |
Wed, 07 Apr 2021 05:39:13 -0400 |
Newsgroups |
dbase.getting-started |
Akshat Kapoor Wrote:
> Good Afternoon Roy,
>
> >>> I have a dmd linking a table with three other tables that contain images (three files because of file size limitations)
>
> This was the reason due to which reduction in file size was recommended.
> >>>
> >>> The form works by stepping through the table, and selecting a matched image from one of the three files. (currently shown on different areas of the form)
> >>>
> >>> My problem is that I cannot close an image from the first table, when stepping through the table, if it selects an image from one of the other two files.
> >>> ? I cannot close the image because the events in the image setup do not include OnOpen or OnClose.?
> >>> How can I close one image when another is opened from another file?
>
> We do not have the code you are using and hence just a blind
> recommendation only.
> There must be some sort of onNavigate event which will be changing the
> image being displayed.
> In that event check which image you want to display.
>
> Change the visible property of that image control to true and balance 2
> controls to false. They will no longer be visible.
>
> or
>
> Set their datalink to null
>
> >>>
> >> function RADIOBUTTON1_onChange()
> >> if this.value = true
> >> form.image1.dataSource = form.fish1.rowset.fields["fish image"]
> >> else
> >> form.image1.dataSource = form.fish2.rowset.fields["fish image"]
> >> endif
> >> return
> The above code shows that changing of datasource property is possible
> and the result is displayed.
> So you MAY need just 1 image control only unless you want all 3 due to
> some other reasons.
>
> > I'm not sure where this proposed solution gets me. The sql statements restrict the selection to "where ID ='1'", or "where ID='2'''
> > So I only see two records with ID 1 or 2.
> This was a demo code. If the condition is removed then you will have to
> insert some code for navigation of tables also.
>
> > Most of the responses to my question just recommend image editing software to reduce file sizes. But that does not answer the problem.
> At times threads do go off the track.
>
> > The images are on three separate files which are linked by a common fieldname to the main table.
>
> I think the above points should have answered this question. But in case
> it does not then please post the portion of code that decides which
> image to show.
>
> I am using images in some parts of my code but I never store them in a
> table. I just store their unc path.
> Image control accepts unc paths and hence there are no issues even over
> network.
>
> Regards
> Akshat
Hello Akshat,
This is the code that currently displays the images in three areas...
this.IMAGEPHOTO01 = new IMAGE(this)
with (this.IMAGEPHOTO01)
onOpen = class::IMAGEPHOTO01_ONOPEN
onClose = class::IMAGEPHOTO01_ONCLOSE
height = 21.5
left = 89.0
top = 16.5
width = 87.0
dataSource = form.cactusaadatamodule1.photos01_dbf1.rowset.fields["photo"]
alignment = 3 // Keep Aspect Stretch
endwith
this.IMAGEPHOTO02 = new IMAGE(this)
with (this.IMAGEPHOTO02)
height = 17.5
left = 176.0
top = 0.5
width = 82.0
dataSource = form.cactusaadatamodule1.photos02_dbf1.rowset.fields["photo"]
alignment = 3 // Keep Aspect Stretch
endwith
this.IMAGEPHOTO03 = new IMAGE(this)
with (this.IMAGEPHOTO03)
height = 19.5
left = 176.0
top = 18.0
width = 82.0
dataSource = form.cactusaadatamodule1.photos03_dbf1.rowset.fields["photo"]
endwith
Straightforward.....
And this is my attempt to deal with the problem (which doesn't work).
Also tried the same with OnClose()
function IMAGEPHOTO01_onOpen()
do case
case form.cactusaadatamodule1.cactusaa_dbf1.rowset.fields["photoyesfile"]='02'
dataSource = form.cactusaadatamodule1.photos02_dbf1.rowset.fields["photo"]
case form.cactusaadatamodule1.cactusaa_dbf1.rowset.fields["photoyesfile"]='03'
dataSource = form.cactusaadatamodule1.photos03_dbf1.rowset.fields["photo"]
case form.cactusaadatamodule1.cactusaa_dbf1.rowset.fields["photoyesfile"]='01'
dataSource = form.cactusaadatamodule1.photos01_dbf1.rowset.fields["photo"]
otherwise
dataSource = form.cactusaadatamodule1.photos02_dbf1.rowset.fields["photo"]
endcase
return
|
|