Link to home
Start Free TrialLog in
Avatar of acteos_lb
acteos_lb

asked on

Creating horizontal toolbar with image items instead of buttons [problem with enter_query]

hi,

i've developed an horizontal toolbar based on images which act like buttons. I set the WHEN-IMAGE-PRESSED trigger for each image and it works fine for "add new record", "delete", "clear", "print" ... except for enter-query, execute and cancel query. When i click on image (enter-query), i enter the query mode, but could not go out of it when clicking on execute-query. It always shows the following message:
>> Enter a query; press F8 to execute, Ctrl+q to cancel <<
When i try to close the form, it executes the query and gives me the results.
So what are the steps to follow in order to execute_query/abort_query when image pressed?

Thanks in advance,

Rgds
Avatar of MarkusId
MarkusId
Flag of Austria image

Could you please give the code of the WHEN-IMAGE-PRESSED-trigger of the execute-query-image?
Avatar of acteos_lb
acteos_lb

ASKER

The trigger code:
go_item('mo.mocode');
if :System.Mode != 'NORMAL' then
    do_key('execute_query');
end if;

where mo is a database datablock.

Thx in advance,

Rgds,
Hi,

Try to give a message after the go_item and before the
do_key('execute_query'), so that you can be sure that the
program is executing the do_key-command.

Do you have a KEY-EXEQRY-trigger on the mo-block?
I've inserted a message('image execute_query pressed');pause; between go_item and the do_key('execute_query'). I didn't see this message when clicking on image execute_query. So the program is not executing the do_key command.

I don't have a KEY-EXEQRY trigger neither on mo block nor on the form level triggers.

Thx again,

Rgds,
Did you put the message inside the IF or outside the IF-block?
If you put it inside  please put it outside and also show the :system.mode-variable.
It was outside the IF-block.
When i click on enter-query, i enter the enter-query mode, when i click on the execute_query, nothing happens, as if i didn't press that image or as if i pressed any other image.

The code of When-Image-Pressed trigger of execute_query image is:
go_item('mo.mocode');
message('image execute_query pressed');pause;
message('mode='||:SYSTEM.MODE);
if :System.Mode != 'NORMAL' then
    do_key('execute_query');
end if;

when pressing on execute_query, nothing happens. Then i try to close the form, a message appears (FRM-41008: Undefined function key. Press Ctrl+F1 for list of valid keys.) it executes the code of the above trigger. 2 messages appear [image execute_query pressed] and [mode=ENTER-QUERY].
Same happens to cancel_query image. When i click on enter_query then cancel_query, nothing happens. When i try to close the form, it cancels the query (message: Query cancelled)

Thx

Rgds,
Could it be that the image-item is not enabled? Try to put a

set_item_property('your_image_item', ENABLED, PROPERTY_TRUE) in the WHEN-IMAGE-PRESSED-trigger of the enter_query-image.

Please also put a

synchronize;

after the message, so the messages should pop up when they appear, not when Forms has time for them.
The image is enabled.
In all cases, i've inserted the set_item_property of the execute_query image @ the top of the W-I-P enter_query trigger. And added synchronize; after the message();pause; in the W-I-P execute_query trigger. But it's always the same result. It does not execute query.

Thx again

Rgds,
Hi,

What if you use just

execute_query

instead of do_key('execute_query')?
Hi,

I used execute_query instead of do_key('execute_query'); and it's always the same error. The problem is that the image execute_query (and all the other images of the toolbar) is ignored when mode is 'enter-query'. As if i didn't click on the image.

Thx again

Rgds,
I don't have error. I meant that it's always the same situation. The image execute_query is ignored.
Hi again,

I think i found the solution.
For info,
I've created a timer on W-I-P of enter_query image. And i added When-Timer-Expired trigger on the form level with code "null;". Now i can enter_query and execute_query or cancel it. The only remaining point is that when clicking on execute_query i get the following message:
FRM-41009: Function key not allowed. Press Ctrl+F1 for list of valid keys.
Why am i getting this error and how can i remove it?
another point is that what happens to the form when timer expires?
i've added the following code to W-T-E trigger:
message('system.current_block= '||:system.current_block)
message('system.mode= '||:system.mode)
message('system.message_level= '||:system.message_level)
and got the following results:
system.current_block= MO
system.mode= ENTER-QUERY
system.message_level= 0

So what happens to the form when timer expires?

Thx

Rgds,
SOLUTION
Avatar of MarkusId
MarkusId
Flag of Austria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial