We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

acteos_lb
acteos_lb asked
on
Medium Priority
1,086 Views
Last Modified: 2012-05-06
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
Comment
Watch Question

CERTIFIED EXPERT

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

Author

Commented:
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,
CERTIFIED EXPERT

Commented:
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?

Author

Commented:
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,
CERTIFIED EXPERT

Commented:
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.

Author

Commented:
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,
CERTIFIED EXPERT

Commented:
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.

CERTIFIED EXPERT

Commented:
Please also put a

synchronize;

after the message, so the messages should pop up when they appear, not when Forms has time for them.

Author

Commented:
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,
CERTIFIED EXPERT

Commented:
Hi,

What if you use just

execute_query

instead of do_key('execute_query')?

Author

Commented:
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,

Author

Commented:
I don't have error. I meant that it's always the same situation. The image execute_query is ignored.

Author

Commented:
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,
CERTIFIED EXPERT
Commented:
Hi,

could you please also post the code of the enter-query-image? I had a look at one of my applications and there was no problem with this combination.

The WHEN-TIMER-EXPIRED only checks for the timer, and as long as you don't delete the timer there will always be a background process waiting for it. Nothing else happens to the form when the timer expires.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Hey,

I came back to my toolbar couple of days ago. Then deleted timer trigger (W-T-E) and the creation/deletion of timer in enter_query/execute_query/abort_query images trigger. I used When-Mouse-Up trigger instead of When-Image-Pressed. Then compiled it and now it works fine. The code of enter_query image trigger is now:
IF :SYSTEM.MODE = 'NORMAL' THEN
      do_key('enter_query');
END IF;
I think the main problem was that i wasn't executing go_item every time i click the image icon. When i did it, it worked fine. I can see now that there was no need of using a timer.
Thank you MarkusId for your answers and for your time.

Rgds,
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.