Sending an event to main application window

4GLNewbie

Member
Help me if you can, please. I searched the forum but didnt find anything useful.

I have a frame where a trigger is set to do something when a certain key is pressed.
I have done that whit an ON <key> OF <frame> ANYWHERE statement.

But my problem is that also the main window reacts to this key pression.
I have interrupted the normal flow of events..

How do I make the main program flow come back to normal ?
I suppose I have to send the keypress event to the correct window, is there any way to do it without having an handle pre-initialized ?

Any suggestion is appreciated. Bye!
 

4GLNewbie

Member
Ehm the statements that have to be executed on key-pression are correctly executed.

Before I added that working code ( to check data inserted ), the program did something else, like saving data.
Now that I added the code it does not happen anymore.

ON <key> OF FRAME <name> DO:
IF <condition> = FALSE THEN
RETURN.
END.

If the condition is not met the program shows a message and remains there.
If the condition is met the message is not shown ( correctly ) but data is not saved.

Is it more clear? I think I just take care of the keypression before the main program catches the event.
I need to make main program flow come back to normal in some way.
 
I think you can do it like this,

on <key> <anywhere> do:
if frame-name = <framename> then do:
-----
-----
end
end.

if you want to fire it on any specified field then you add one more criteria like frame-field = <framefield> along with frame-name.
 

4GLNewbie

Member
Okei. And then i when i press <key> on keyboard, i will do something in my frame.
But this is not my problem.

My problem is that before my modifies, <key> caused the main window to do something. And now that does not happen anymore. So program doesn't work correctly.
 

4GLNewbie

Member
Okei, i solved it another way. In fact it was all ready and prepared, i was as blind as a mole while reading the code.. it happens when one is new to the language and software developed i suppose.

I'm still courious if there's a solution to the problem without having to manage the key-pression event redirected to a specific function in the frame.
 

lord_icon

Member
I am aware that this has been solved. Though this is the Progress 4GL feature, PUBLISH & SUBSCRIBE. Where window 1 PUBLISHES a named event, and window 2 SUBSCRIBES to the event. Then in window 2 have the appropriate code behind the trigger for the named event.
 

4GLNewbie

Member
Now i know it.
Then if i want window1 to do something when the named event is fired, i cannot subscribe it in window2?

I am forced to write a code like this in window1..

ON <named-event> OF <window1> DO:
IF <condition> in <window2> = TRUE THEN <do something>
END.

Right?
 
Top