-   Code & Utilities (
-   -   Pictures on Baan IV Forms (

Ruskin 9th September 2003 05:34

Pictures on Baan IV Forms
1 Attachment(s)
Firstly, I can not take any credit for the development of this code... It was posted in the thread: Photo Display on Form , by '~Vamsi'. I have just turned it into an easy to use include....

Simply call it by;<full path and filename to GIF file>)

Don't forget to destroy the objects with;
either in the choice.end.program and choice.abort.program, or when you need the picture cleared..

en@frrom 9th September 2003 09:56

will this code not work for Baan V?

Ruskin 9th September 2003 22:06

never tried in Baan V, but can't see why not (it wouldn't be a difficult job to port it to Baan V, if it doesn't)...

en@frrom 17th September 2003 14:09

Resizing windows
Hi Ruskin,

Used this function, and seems to work well. Have got one problem though:

Say I use this in a display session, where the session opens let's say on nearly full screen. In the init.form (tried also before.form) I call the function to display a gif in the top-right corner. This works ok. Then I resize the window (just with the mouse) and make it smaller. The gif's location will not be adjusted accordingly (i.e. recalculate the proportions from the window edges), and as a result the whole window looks clumsy with this gif stuck out there on an unsuitable location. Basically it will be impossible to decrease the window-width smaller than the original size, because this gif stays stuck on the original (width) location.

Encountered this? Have a solution for it? Would be great, because the way it is now, I cannot apply it.



NvanBeest 17th September 2003 14:19

Hi En.

Have a look at the function change.sub.object. You could call this to move and/or resize the picture in the choice.resize.frm section.

Ruskin 18th September 2003 05:50

Not sure if the solution by NvanBeest will work (redrawing the sub-object, when the main object is not large enough, won't work)... It may automatically resize the main object, so will be worth trying. But the best solution, is as he suggested, in the choice.resize.frm

What you should do, is call;

Then call the;
function, to recreate the photo, with the new x,y co-ordinates and photo height/width. You may need to determine the x.y co-ordinates yourself in this case.

Thus, when the user resizes the form, it clears and redraws the image.

learner 22nd September 2003 18:22

could u please provide a screen shot

Could u please provide a screen shot of the form with the pic on it.... I don't have an access to the system right now.



en@frrom 23rd September 2003 12:58

Hey Ruskin,

Thanks for your advice. I had already tried the way you described, but received bw-errors. Thought it was as a result. After debugging, I saw that in the function, there is a destroy on object.mimg which caused the errors, for there was never an update.object on object.mimg...

I now use a and in the choice.resize.frm after.choice section (and in case of multiple forms -> tabs, it is necessary to re-display also on each before.form), and now it works perfectly.

Thanks a lot!!

Kind regards,


~Vamsi 23rd September 2003 14:49


Could you please post the code with the updates.

en@frrom 23rd September 2003 16:35

I made only few little changes.

Here it goes:
In function

        long        int.value(MWINMAXSIZE)

|        if not igen0100.init        or
|          igen0100.form.width = 0  or
|          igen0100.form.height = 0 then
|                igen0100.init = true
                igen0100.object.main = current.mwindow()
                igen0100.form.width  = int.value(11)
                igen0100.form.height = int.value(12)
|        endif

I pipe-lined the conditions, because I want the window attributes to be re-read every time the function is called [in order to get the right location when resizing a form].

In function

|        destroy.object(igen0100.object.mimg)

I pipe-lined the destroy.object(igen0100.object.mimg), because there is never an update.object on mimg; therefor it results in a bw-error 'Object %d not found'.

For the rest I only changed some of the default sizing and positioning, but this is depending on each one's personal preferences. I for instance do not understand why the minimum height+width sizes have to be 100 (any reason Ruskin??), so I pipe-lined this piece:

|        if igen0100.hght < 100 then
|                igen0100.hght = 100
|        endif
|        if igen0100.wdth < 100 then
|                igen0100.wdth = 100
|        endif

I finally changed the default locations in the default.x/y.position() functions to be displayed default in the far top right corner. So for default x pos I have:
return(igen0100.form.width - igen0100.wdth)
and for y pos:



Ruskin 25th September 2003 02:32

Thanks En...

Sorry I haven't responded earlier, haven't been to the site for a few days.

You are quite correct, the sub object does not need a 'destroy.object' function for it. Thanks for pointing that out... Also, I found I got some BW errors when destroying the object multiple times, so amended the clear function as follows;

        if igen0100.object.mpix then
                igen0100.object.mpix = 0
        if igen0100.object.midc then
                igen0100.object.midc = 0
        if igen0100.object.midp then
                igen0100.object.midp = 0
|        destroy.object(igen0100.object.mimg)
        if igen0100.object.main then

The only reason I made the minimum height and width at 100, was for our photos. At that size they fit on our form perfectly and aren't dis-proportional. It's entirely up to you, whether you use that minimum size or create your own...

kind regards...

en@frrom 25th September 2003 09:29

Thanks Ruskin!

en@frrom 12th June 2006 15:11

Improved version..
1 Attachment(s)
To all that may find it usefull...

I have used Ruskin's function for the past couple of years for displaying of logo's on some customized sessions. I was now working on a good efficient item file as a display session in Baan. One of the requirements, was including images of the item, up-to 5 images per item.

I wanted to use my existing function (Ruskin's), but saw that the function can actually only handle display of one image per form. I therefor improved the function to be able to handle display of up-to 5 images each time.

There is an optional argument in the function call, which passes the image number. I have done it in the way of an optional argument, so that I will not have to change all the program scripts which call the function till now... If the optional argument is not filled, then the image number will be defaulted to 1 (for display of one image only).

Attached is the code...

If anyone has further suggestions and/or remarks, I'm always here to listen...


jhansirani 1st July 2006 08:26

Hi Ruskin,
Is this is helpful for multiple records? Example - if we select empno and we select photo - it will go for particular employee.gif and display?

Thanks & Regards,
Jhansi Rani B

en@frrom 3rd July 2006 09:26

Of course you can do it. I use it for instance for items. Per item I could have up to five different images. So the file names are <itemcode>1, <itemcode>2 etc, and the session calls the corresponding images.

The same you can do with your employees...

Good luck!

All times are GMT +2. The time now is 12:02.

©2001-2018 - -