~Vamsi
15th July 2002, 22:41
This question was asked and answered on Baanfans a few years ago. I am posting all the threads I believe are related to this subject. Please post a final code release to Code & Utilities if this results in useable code. Grzegorz's website link is unreachable. Perhaps he can share his code with us.
~Vamsi
Ivan Simeonov posted Message on May 19, 1999 at 05:30:09 EST
The following code is just an idea, to show employee picture in Maintain Emploees Session.
long pixid, w, h, z |#BG002
long toplevel
#include "itgbrgeditor"
#include "itgbrg0001"
....
form.1:
after.form:
if toplevel then
destroy.object (toplevel)
toplevel = 0
endif
before.form:
string picture.name(250)
picture.name = tccom001.photo
if not (strip$(picture.name) = "") then
toplevel = create.object( DsCgwindow, current.mwindow(),
DsNwidth, 160,
DsNheight, 160,
DsNx, 550,
DsNy, 60 )
pixid = load.pixmap.file(bse.dir$() & "/photos/" & picture.name, w, h)
if pixid then
create.sub.object(toplevel, DsCgpImage,
DsNx, 5,
DsNy, 5,
DsNwidth, w,
DsNheight, h,
DsNpixmap, pixid )
endif
update.object( toplevel )
endif
Vineet Sawant posted Message on June 12, 1999 at 01:04:42 EST
Hi everyone,
Ever wanted to see Logo on your BaaN screens?? Do all this and more with the steps given below. The code for this is
there in BaaN Tools itself!! Read the section on Create.Object (3 GL function), the example given at the end can be copied almost as it is , with a few changes. Works for NT as well as UNIX.
PUT THIS CODE INTO INIT.FORM for ANY SESSION. THE GIF WILL BE DISPLAYED ON THE XPOS,YPOS THAT YOU SPECIFY.You must have source code (program script) for that session.
long cmap(256)
long cmap_sz
string imap(1) based
long icon_w
long icon_h
long valid.icon
long gwin
string file(128)
string bufr(1) based
long buflen, fp
long idc, idp, image
gwin = create.object(DsCgwindow,current.mwindow(),
DsNbackground, <Long Color>,
DsNx, <Long Xpos>,
DsNy, <Long ypos>,
DsNwidth, <Long WIDTH OF YOUR GIF file>,
DsNheight, <Long HEIGHT OF YOUR GIF file>,
DsNpointerCursor, DSCHAND,
DsNeventMask, EVTALLEVENTMASK )
file = "${BSE}/gif/desktop.gif/<yourgif>"|YOUR GIF file here
fp = seq.open(file, "r")
buflen = seq.seek(0, 2, fp)
alloc.mem(bufr, buflen)
seq.rewind(fp)
seq.read(bufr, buflen, fp)
seq.close(fp)
if get.pixmap.info(bufr, cmap_sz, icon_w, icon_h) then
alloc.mem(imap, icon_w * icon_h)
valid.icon = decompress.pixmap(bufr, cmap, imap)
cmap(1) = rgb(128,128,128)
endif
free.mem(bufr)
update.object(gwin)
idc = create.object(DsCcolormap,current.display(),DsNcolorTable,cmap,cmap_sz)
idp = create.object(DsCpixmap,current.display(),
DsNcolormap, idc,
DsNwidth, icon_w,
DsNheight, icon_h,
DsNdata, imap, icon_w * icon_h,
DsNdataType, DSPIXMAP8 )
image = create.sub.object(gwin, DsCgpImage,
DsNpixmap, idp,
DsNx, 0,
DsNy, 0 )
POINTS TO REMEMBER:
Copy your GIF file to any of the subdirectories under $BSE/GIF..such as desktop.gif, etc. Remember thses are directories, not GIF files. Then, RENAME your .GIF file such that it does not have the .GIF extension..ie rename VIN.GIF to VIN, even for NT.
Its surprising , you can do things in BaaN you never thought possible, and the code is there , hidden away in BaaN Tools Help.
If any of you have any such stuff to share , please share it with all of us BaaN developers. It makes our normal mundane BaaN lives much more interesting!
Grzegorz posted Message on January 05, 2001 at 15:56:47 EST
: Hello pretty baanfans, i'm triyng to put an icon .gif in a normal session of BaaN. I know i have to use "create.object" functions, but the help is very confuse... Anybody has an example?
: Thanks. Kisses.
Please see at http://www.dst.com.pl/oferta/of_baan_szp_kadry.htm
Look at second screenshot (employee data with picture).If this is what you want to get, pls email me.
Regards
Grzegorz.
Ulrich Fuchs posted Message on January 08, 2001 at 06:09:15 EST
: Hello pretty baanfans, i'm triyng to put an icon .gif in a normal session of BaaN. I know i have to use "create.object" functions, but the help is very confuse... Anybody has an example?
: Thanks. Kisses.
Following is something that I tried out after a posting of someone within that forum:
form.1:
init.form:
long cmap(256)
long cmap_sz
string imap(1) based
long icon_w
long icon_h
long valid.icon
long gwin
string file(128)
string bufr(1) based
long buflen, fp
long idc, idp, image
gwin = create.object(DsCgwindow,current.mwindow(),
DsNbackground, 0,
DsNx, 30, | YOUR GIFs POSITION HERE
DsNy, 100,
DsNwidth, 110, | YOUR GIFs WIDTH & HEIGHT HERE
DsNheight, 120,
DsNpointerCursor, DSCHAND,
DsNeventMask, EVTALLEVENTMASK )
file = "${BSE}/gif/Auroflex/deskt01/delete01"|YOUR GIF file here - NAME IT WITHOUT THE .gif EXTENSION!
fp = seq.open(file, "r")
buflen = seq.seek(0, 2, fp)
alloc.mem(bufr, buflen)
seq.rewind(fp)
seq.read(bufr, buflen, fp)
seq.close(fp)
if get.pixmap.info(bufr, cmap_sz, icon_w, icon_h) then
alloc.mem(imap, icon_w * icon_h)
valid.icon = decompress.pixmap(bufr, cmap, imap)
cmap(1) = rgb(128,128,128)
endif
free.mem(bufr)
update.object(gwin)
idc = create.object(DsCcolormap,current.display(),DsNcolorTable,cmap,cmap_sz)
idp = create.object(DsCpixmap,current.display(),
DsNcolormap, idc,
DsNwidth, icon_w,
DsNheight, icon_h,
DsNdata, imap, icon_w * icon_h,
DsNdataType, DSPIXMAP8 )
image = create.sub.object(gwin, DsCgpImage,
DsNpixmap, idp,
DsNx, 0,
DsNy, 0 )
NPRao
16th July 2002, 00:06
Hi Vamsi,
Thats was great posting...!!! :p
I tested the solution, the 2nd code worked fine...
However, I am getting compilation error for the 1st coding you posted -
pzmadmtest0( 140): Error: Unresolved reference to function 'load.pixmap.file'.
Any clues ?? :confused:
I was thinking in the line of making a gif editor, something which we had on the TCS in BaaN. :cool:
Thanks!
NPRao
24th July 2002, 22:56
Hi Jai,
I wouldnt extend any more functionality if its already available in standard BaaN.
New functionality in BaanERP 5.2a
Difference Study iBaanERP 5.0c - 5.2a3-19
3.4 Dynamic Form Editor (DFE)
This section describes the DFEs new functionality in BaanERP 5.2a.
3.4.1 Pictures on forms
In BaanERP 5.2a, you can use the DFE to insert a picture (gif format) on a sessions form. The picture you insert must be in the Icon Groups (ttdsk9100m000) session in the icon group form_<pp>, where pp is the package code of the session whose form you want to insert the picture on.
To insert a picture on a sessions form with the DFE:
1 Select Insert ►Picture, or click the picture icon on the toolbar. The picture properties dialog box appears:
Figure 3-19 The DFEs Picture properties dialog box.
2 Click the zoom button on the Icon field. The ttgbf0005m000 window appears with the icons available to you. Select your icon.
3 You can select the:
−−−−Details Session check box for the picture to appear on the details sessions form.
−−−−Overview Session check box for the picture to appear on the overview sessions form.
−−−−Child Field(s) Behind check box to place the pictures child field(s) (if any) immediately behind the picture.
4 If you want a label for your picture, enter the required details in the fields of the Label box.
5 Click OK.
You can use the programming function long.change.picture()to
change the picture on a form at runtime. The picture you use to replace the existing picture must also belong to the icon group form_<pp> in the Icon Groups (ttdsk9100m000) session.
I guess Vamsi has give good ideas and *timed out* this discussion. :p
hsteenwi
23rd August 2002, 17:04
Vamsi,
In name of our programmers, I have to thank you for the coding you posted. I passed it on to them, and they've not been doing their job until this moment, being happy as children with all kinds of pictures on their forms.
In short: great stuff!
Henk.
hsteenwi
26th August 2002, 07:42
Vamsi,
May the thanks I expressed spread out over the people you mention...
Our programmers are, as I said earlier, experimenting with the coding. Any interesting improvements they might stumble upon I will ofcourse share with those who love BaaN or who are, in any way, forced to live with it.
Henk.
NvanBeest
8th September 2003, 18:17
Don't bother to try! I had some time to kill, and called it in many different ways, from different sections in a 4GL script, and no luck! :( The code ~Vamsi gathered does work, so I'm using that now.
Joy Conner
16th July 2009, 17:03
I am working on the display of gif images. I have used code posted in this thread and my image is displayed.:D The only change I made to the code is the location of it's call. This thread executes the image display during the init.form. I have the code in a function, display.image() and have called it from the following places:
main.table.io:
after.read:
choice.find.data:
on.choice:
field.table.photo:
when.field.changes:
before.display:
after.display:
The name of the image is stored in table field. I am expecting the image to change when navigating from one record to the next. The form type is a single occurrance.
The problem that I am having is sometimes the image is displayed as a black block on the form. :confused: I have posted an example. The attachment is a screen image of the same record. On one, the image is correct, on the other, the image is displayed is a block rectangle.
Any ideas on what might cause this?
This may not be pertinent but I have observed when I navigate from one record to the next quickly, I see more black rectangles. When I allow some time to pass; I count to 6 slowly; then I see less black rectangles.