en@frrom
9th January 2007, 16:17
Hey all,

See this link (http://www.baanboard.com/baanboard/showthread.php?t=12892) as a reference...

I am displaying images on my Baan forms using the method described in the aforementioned thread. When moving the cursor over such an image (object) the cusor changes from the 'arrow' sign to a 'hand', i.e. giving the impression you could click on it to activate some control/link which is behind the object.

My requirement is exactly that: I want to be able to click on an image and activate a url-path containing to a large picture stored on the server (opened let's say in the default picture browser, in IE, etc).

Does anyone know of a way to add functionality behind those images/objects?


Kind regards,
Eli Nager

mr_suleyman
11th January 2007, 13:11
I don't think that there is way to solve it on Baan. May be you can use HTML to handle it ?

Good Luck!

en@frrom
11th January 2007, 13:27
How would I be able to handle it by using HTML? I don't mind the HTML, the whole issue is capturing the click-event on the item displayed on form...

Actually I do have the feeling that it mus be possible, from looking at all the functions and events in the Baan-help -> objects-functions and the long line of DsC/DsN events etc

I do not know those functions/events well enough, and therefor thought maybe someobody around here knows more...

mr_suleyman
11th January 2007, 13:43
I don't know your structure but you can cunstruct your html file and easily open from baan. Almost everything is possible on html. I hope there is a way on baan.

Good LUck !

norwim
11th January 2007, 17:52
<Quote>..... you can cunstruct your html file and easily open from baan.</Quote>
Could you please explain what you meant here? Open a html file from Baan ....
with seq.open?

thx in advance

Norbert

mr_suleyman
12th January 2007, 08:25
I don't implement it. But Why not possibble? I think that it can be done template html structure. Only u should send picture place and link information parameter to this template file. It can be run from baan By using app_start command .
That' all norwim

en@frrom
12th January 2007, 09:49
In the motto of "Everything is possible", impossible is a non-existing word in my dictionary, and the famous (Dutch?) saying: "Where there is a will, there is a way, and where there is no way there is detour...", I decided that I will let this work anyway the way I want it, namely that upon clicking on an image on my form, I will display that image in big. Of course the only difficulty is capturing/identifying that click on the image. The actions performed upon clicking don't really matter, everything is possible (displaying picture, some report, different session, spreadsheets, graphs, anything)...

I thought of the concept and just have to find the correct way to apply it in code... Will post it here for people once I have a stable code.


Regards,
Eli Nager

csecgn
12th January 2007, 12:57
I've done some (not successfull) experiments with your question, the eventhandler, timers, ... .
I've seen a NOVENTS during creating the object in the include(last line if remember correctly). Maybe it would an idea to send EVTBUTTONPRESS or EVTBUTTONDPRESS instead of. If it works, the "only" remainig problem is to find a place where you can create your eventhandler function and how to call it... . Timer? (works, but has not been "fast/precise" enough during my experiments)

Just an idea

Regards
csecgn

george7a
12th January 2007, 13:01
Hi,

I don't think that the timer will work. I have tried something simpler and the timer didn't work:
http://www.baanboard.com/baanboard/showpost.php?p=104488&postcount=9

- George

csecgn
12th January 2007, 13:09
I've used the timer only for calling my eventhandler-function.. But it has been to slow (or to fast sometimes). It has been the easiest way to call choice.interrupt: where the function has been placed.
If I find time, I try at monday again (or another way).

Regards
csecgn

en@frrom
12th January 2007, 13:53
Hey guys,

As promised I have played around with this, and achieved a nice solution... Will try to explain clearly...

My requirements:

In my session I display per item all kinds of relevant data, and display up to 4 gif-files (depends how many available per item) with images of the item on the screen. The images are placed as objects using the Baan object-handling functions.

What I wanted to achieve was to double-click an image and display an enlarged JPG-version of the photo clicked. Because I display up to 4 images per screen, I need to know also which of the pictures I clicked.


Solution:

I created a new 3GL program which activates a timer, and then every 0.5 seconds checks for a left mouse click on an object. If an object is clicked, it checks whether this is an image object, and opens Internet Explorer with the corresponding picture.

In the display session, while displaying the pictures, I count how many pictures I display for this item, and keep the object id -> =return value of funtion create.object() of each image in an array.

Then after displaying the images on screen I start my 3GL program, export/import the item number (picture file names are based on item number), number of pictures displayed for this item, and the object id numbers for each displayed picture.

When a left mouse event is captured, it checks whether this was on one of the pictures on the form, and if yes displays the enlarged jpg-version of the picture in Internet Explorer.

This works fine. The only thing that bothers me now, is that it takes 4-5 seconds until the Internet Explorer is opened with the picture. I don't know yet why this is, it is for sure not due to the file size of the picture, because I tested it also with small files of <10kb, and it took as long. Maybe the function app_start() is very slow...? Dunn, will still have to play around with that...

Piece of code in the main session:

for j = 1 to 4
file.name = "e:\baan\gif\artikels\" & strip$(shiftl$(tcibd001.item)) & "_" & str$(j) & ".gif"
fid = seq.open(file.name, "r")

if fid > 0 then
if pics = 1 then
igen0100.display.photo.in.location(-10, 450, 191, 344, "e:\baan\gif\artikels\blanc.gif", pics)
endif
pics = pics + 1
igen0100.display.photo.in.location(x.pos, 470, 160, 120, file.name, pics)
x.pos = x.pos + 160

pic.id(pics - 1) = igen0100.object.mpix(pics)
endif
endfor

if pics > 1 then
timer = activate("otcromtimer", tcibd001.item, pics - 1, pic.id(1), pic.id(2), pic.id(3), pic.id(4))
endif

Make sure to kill the 3GL session at the right places, like in choice.abort.program, choice.end.program, and form.x, after.form. Just code:

if timer then
kill(timer)
timer = 0
endif

Note: I initialize 'timer' because I am checking on timer > 0 on several places, so this is important...


the 3GL code:

|******************************************************************************
|* Title : tcromtimer - Timer handling and event capturing (for tcrom0101me00)
|* Author : Eli Nager
|* Date : 12/01/2007
|******************************************************************************
|* Script Type : 3GL
|* Copyright 2007 by Eli Nager
|*
|* All Rights Reserved
|*
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation.
|*
|* ELI NAGER AND BAANBOARD.COM DISCLAIM ALL WARRANTIES WITH REGARD TO
|* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|* AND FITNESS, IN NO EVENT SHALL ELI NAGER NOR BAANBOARD.COM BE LIABLE
|* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|*
|****************************************************************************

|****************************** DECLARATION SECTION ***************************

table ttcibd001


domain tcmcs.long i, j

extern domain tcmcs.long tim.id, obj.id, i.pic.id(4), i.pics
extern domain tcitem i.item

#pragma used dll ottdllbw


|*****************************************************************************

function main()

{
i.item = argv$(1)
i.pics = lval(argv$(2))

j = 1
for i = 3 to (i.pics + 2)
i.pic.id(j) = lval(argv$(i))
j = j + 1
endfor

tim.id = set.timer(500)

handle.events()
}



function handle.events()
{
long event(EVTMAXSIZE)
string start(1024) | Start command
long rc | Return code.
string appl(132) | Application to start.
long app_id | Application id.


while next.event(event)
ON CASE evt.type(event)
case EVTBUTTONDPRESS:
case EVTBUTTONRELEASE:
if evt.button.button(event) = EVTBUTTON1 then
obj.id = evt.window(event)

for i = 1 to i.pics
if obj.id = i.pic.id(i) then
appl = "iexplore.exe"
start = appl & " " & "\\es7000F\baangif\artikels\" & i.item(10;6) & "g_" & str$(i) & ".jpg"

app_id = app_start(start,"","","","")

rc = app_status(app_id)
if(rc = 0) then
message("Could not start application")
endif
endif
endfor
endif
break

default:
break
ENDCASE
endwhile
}

(I decided to be brave and add the whole copyright/disclaimer blabla... :rolleyes: )


The reason I handle the event capturing/checks in a seperate 3GL program, is because the standard program is full of events, and when manipulating the way I do (every next.event() basically ignores the current event... etc), I would corrupt my standard (main) program every second or third time I would click on something... The advantage of doing this in a seperate 3GL, is that all this program does is timing and checking events, and does not have a form the user could click on, so no risk of interrupting/corrupting the standard flow of the program.


Hope this is clear and moreover usefull for others.

Any input/feedback/comment etc is very welcome.


Regards,
Eli Nager

mark_h
12th January 2007, 16:36
YEAH - my comment is "Great solution". I wish I had the opportunity to apply this somewhere.

mr_suleyman
12th January 2007, 16:39
Congratulations !
I think this thread should be add on Code & Utilities Part

mark_h
12th January 2007, 16:52
I think it is okay where it is since it is already linked into the other thread.

en@frrom
15th January 2007, 09:47
Mark, I am surprised you do not have where/how to apply it. If you happen to apply it at some point anyway, please give me feedback and/or further comments/suggestions. I didn't put so much time in this, there surely must be ways to enhance it...

As for adding this code to the codes & utilities forum: there is already a thread there which gives the general solution for displaying images on Baan Forms, so I will add my code as a comment in that existing thread; like this people will find a complete solution in one thread...


Regards,
Eli Nager