Subject Re: Closing an image on a form
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Wed, 7 Apr 2021 13:33:49 +0530
Newsgroups dbase.getting-started

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