Image Trigger...

eMe

New Member
Hi,

I have a problem with the trigger of an image. I'm using 10.1B. I added an event on Left Mouse Click in an image. It makes a frame visible, and then, after users selects something, the frame hides again.

Ok, this work fine, but, once tou have click on the image... the trigger doesn't work again. I have tried to reload the image (and see if magically the widget works again) I have "applied on choose" after the frame hides, sensitive = true.... well, here is a piece of code.

/** The 'magic' trigger that only works once **/
ON LEFT-MOUSE-CLICK OF imgEuropa IN FRAME fMain
DO:

FRAME frPaises:MOVE-TO-TOP().
FRAME frPaises:VISIBLE = TRUE.

/** some code **/
/* test if thie would repair my trigger... no, it didn't */

SELF:SENSITIVE = TRUE.

END.

/** The piece of code which executes whe I hide the frame **/
FRAME frPaises:MOVE-TO-BOTTOM().
FRAME frPaises:VISIBLE = FALSE.

/** more little tricks... none works :( **/
ENABLE imgEuropa.
imgEuropa:SENSITIVE = TRUE.
imgEuropa:LOAD-IMAGE("smthg.jpg") IN FRAME fMain.
APPLY "U1" TO imgEuropa IN FRAME fMain.

/** No more **/

I forgot, event U1 just display an alert-box and when I try it, after hiding the frame it does display the message... buuuut, the on left mouse click... doesn't work...
 
Continuing my monologue...

I found is due to the code I have after clicking the image. In this code I create images dynamically with a trigger, on left mouse click, which calls persistent procedure. I have removed the trigger definition and the error stills there... must be something with the creation of the images...

CREATE IMAGE hndlImage
ASSIGN
NAME = "IMAGE-" + STRING(hndlImage)
ROW = pRow
COLUMN = pCol
WIDTH = pAncho
HEIGHT = pAlto


FRAME = FRAME frPaises:HANDLE
SENSITIVE = TRUE
VISIBLE = TRUE
TRIGGERS:
ON 'LEFT-MOUSE-CLICK':U PERSISTEN RUN seleccionaPais IN THIS-PROCEDURE (pID_Pais).
END TRIGGERS.
 
I'm not sure if this will help, but here is a snip of code that we have run for many years without problems. It sounds similar to what you are doing. Note the event names we are looking for, and the comments (I didn't write those now, those are years old). In the related CREATE BUTTON code, we look for ON CHOOSE only.

tmp_widgets is a table containing a bunch of information about buttons and images that this procedure is responsible for creating. int_clicked_image does some processing to create new windows and so on.

Code:
CREATE IMAGE tmp_widgets.wdg_handle
                ASSIGN
                    HEIGHT-PIXELS = p_btn_height * 2
                    MANUAL-HIGHLIGHT = TRUE
                    FRAME = h_frame_handle
                    WIDTH-PIXELS = 40 /* if you change this, change X as well */
                    X = (p_width * 2.4)
                    Y = h_tmp_y
                    VISIBLE = NO
                    SENSITIVE = YES
                    TRIGGERS:
                        /* IMPORTANT! if you omit IN THIS-PROCEDURE, the trigger will **USUALLY** work but its
                        flaky. in particular for some reason if IQMAINF is your default, the FIRST time you
                        invoke the trigger you will get error 293. */
                        ON MOUSE-SELECT-DOWN PERSISTENT RUN int_clicked_image IN THIS-PROCEDURE (tmp_outlook.idx). /* added 8/31 */
                        ON RIGHT-MOUSE-UP PERSISTENT RUN int_right-clicked_image IN THIS-PROCEDURE (tmp_outlook.idx).   /* added 06/11/03 */
                    END.
 
Back
Top