[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

poerbuilder cancel query

Posted on 2009-04-08
2
Medium Priority
?
509 Views
Last Modified: 2013-12-26
i want to make the combination of keys shift+f1 to act as cancel-query keystroke. if it is pressed it should break the query that is being executed and return control to the main program.

How can i do it?

since i am new to powerbuilder i would appreciate the answer to be as clear as possible

0
Comment
Question by:basilhs_s
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
diasroshan earned 2000 total points
ID: 24104736
Hi,

I am assuming u r retrieving the query in a datawindow.
dwcontrol.DBCancel ( ) is wat ur looking for.
Check PB Help for DBCancel.

You would need to use datawindow events RetrieveStart and RetrieveRow

Below is the PB Help example for DBCancel which is pretty detailed.

In this example, the menu bar for an MDI application has menu items for starting and canceling a retrieval. When the user cancels the retrieval, a user function calls DBCancel and sets a boolean instance variable to Get/SetSeriesStyle and Get/SetDataStyle. The RetrieveStart and RetrieveRow events check this variable and return the appropriate value.
In this hypothetical application, the user starts a retrieval by selecting Retrieve from a menu. The script for the Retrieve menu item calls a user function for the window:

w_async1.wf_retrieve()

The wf_retrieve function sets the Async DBParm for asynchronous processing and starts the retrieval. Because Async is set to 1, the user can select the Cancel menu item at any time, even before the first row is retrieved. (In your own application, you would include error handling to make sure Retrieve returned successfully.)

long rc
ib_cancel = false
SQLCA.DBParm = 'Async = 1'
rc = dw_1.Retrieve()

The user can stop the retrieval by selecting Cancel from the menu. The script for the Cancel menu item reads:

w_async1.wf_cancel()

The user function wf_cancel for the window w_async1 calls DBCancel and sets a flag indicating that the retrieval is canceled. Other events for the DataWindow will check this flag and abort the retrieval too. The variable ib_cancel is an instance variable for the window:

ib_cancel = true
dw_1.DBCancel()

Scripts for the RetrieveStart and RetrieveRow events both check the ib_cancel instance variable and, if it is true, stop the retrieval by returning a value of 1. In order to cancel the retrieval, some code or comment in the script for the RetrieveRow event is required:

IF ib_cancel = true THEN
        RETURN 1
END IF

//Example ends here

As far as using a combination of Shift + F1 goes,
to keep it simple, if ur using a menu, u can have a menu item and assign the shortcut key property of that menu item to Shift + F1 and keep it invisible if u want.

Else,
Check PB Help for KeyDown event (DataWindows)
u will have to create a new event in ur Datawindow with event id pbm_dwnkey
say ue_keydnw
Now,
IF keyflags = 1 THEN
      If key = KeyF1! Then      
                    //ur code here
                end if
End If

Cheers,
Rosh
0
 

Author Closing Comment

by:basilhs_s
ID: 31568410
perfect analysis for a novice to powerbuilder like me. thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

656 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