?
Solved

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

Posted on 2009-02-11
15
Medium Priority
?
1,038 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
0
Comment
Question by:acteos_lb
  • 8
  • 7
15 Comments
 
LVL 9

Expert Comment

by:MarkusId
ID: 23609701
Could you please give the code of the WHEN-IMAGE-PRESSED-trigger of the execute-query-image?
0
 

Author Comment

by:acteos_lb
ID: 23609781
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,
0
 
LVL 9

Expert Comment

by:MarkusId
ID: 23609856
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?
0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 

Author Comment

by:acteos_lb
ID: 23610520
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,
0
 
LVL 9

Expert Comment

by:MarkusId
ID: 23610729
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.
0
 

Author Comment

by:acteos_lb
ID: 23610884
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,
0
 
LVL 9

Expert Comment

by:MarkusId
ID: 23611310
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.

0
 
LVL 9

Expert Comment

by:MarkusId
ID: 23611608
Please also put a

synchronize;

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

Author Comment

by:acteos_lb
ID: 23612073
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,
0
 
LVL 9

Expert Comment

by:MarkusId
ID: 23619390
Hi,

What if you use just

execute_query

instead of do_key('execute_query')?
0
 

Author Comment

by:acteos_lb
ID: 23619762
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,
0
 

Author Comment

by:acteos_lb
ID: 23619770
I don't have error. I meant that it's always the same situation. The image execute_query is ignored.
0
 

Author Comment

by:acteos_lb
ID: 23620120
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,
0
 
LVL 9

Assisted Solution

by:MarkusId
MarkusId earned 80 total points
ID: 23641324
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.
0
 

Accepted Solution

by:
acteos_lb earned 0 total points
ID: 23719523
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,
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question