Discussion:
2 ddt questions
(too old to reply)
George McCoy
2004-04-20 19:09:42 UTC
Permalink
I'm writing DDT apps with the latest version of powerbasic for windows.
Two things puzzle me.

How do I make the focus stay on the control where the user leaves it when
minimizing the dialog? I have a little address book, based on the
Powerbasic sample. The screen has a series of labels and textboxes. The
first of these contains the person's first name. If I move to a different
textbox, the company name, for example, and then I minimize the app; when I
return to it the focus returns to the first name textbox. How can I prevent
this? I got close once by storing the value of cbctl when the wm_command
message is received, then setting focus when the wm_setfocus message is
received. I think the focus sets where I want it and then the dialog
receives another windows message that puts it right back to the top of the
dialog. I believe the decimal value of this offending message is 309.

Can anyone suggest anything or show me where I can find an example?

I have a little text editor. It's a richedit control in a ddt dialog box.
When User closes the app, I'd like to ask if he really wants to quit, using
the msgbox() function. I can get the message to appear if I trap either the
wm_close or wm_destroy message but I don't know how to abort the close if
User clicks the no button in my message box. How is this done?

Thanks very much for any suggestions on these items.

George
n***@bounceall.net
2004-04-22 00:46:38 UTC
Permalink
Post by George McCoy
I'm writing DDT apps with the latest version of powerbasic for windows.
Two things puzzle me.
How do I make the focus stay on the control where the user leaves it when
minimizing the dialog? I have a little address book, based on the
Powerbasic sample. The screen has a series of labels and textboxes. The
first of these contains the person's first name. If I move to a different
textbox, the company name, for example, and then I minimize the app; when I
return to it the focus returns to the first name textbox. How can I prevent
this? I got close once by storing the value of cbctl when the wm_command
message is received, then setting focus when the wm_setfocus message is
received. I think the focus sets where I want it and then the dialog
receives another windows message that puts it right back to the top of the
dialog. I believe the decimal value of this offending message is 309.
Can anyone suggest anything or show me where I can find an example?
I have a little text editor. It's a richedit control in a ddt dialog box.
When User closes the app, I'd like to ask if he really wants to quit, using
the msgbox() function. I can get the message to appear if I trap either the
wm_close or wm_destroy message but I don't know how to abort the close if
User clicks the no button in my message box. How is this done?
Thanks very much for any suggestions on these items.
George
suggest you ask in the PB forums at their website
LB
iasm
2004-04-22 06:24:44 UTC
Permalink
Post by George McCoy
I have a little text editor. It's a richedit control in a ddt dialog box.
When User closes the app, I'd like to ask if he really wants to quit, using
the msgbox() function. I can get the message to appear if I trap either the
wm_close or wm_destroy message but I don't know how to abort the close if
User clicks the no button in my message box. How is this done?
Thanks very much for any suggestions on these items.
George
Your looking under the wrong win message: Tthe following will catch command
& menu options to close in your callback procedure

Case %WM_SYSCOMMAND ,tells windows cmd
CANCEL status
Dim x As Long
x = MsgBox( "end app?", %mb_yesno)
Select Case X
Case %IDYES : Function = 0 cancel closure
Case %IDNO : Function = 1 continue with
closure
End Select






-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Michael Mattias
2004-04-22 13:14:28 UTC
Permalink
Post by iasm
Your looking under the wrong win message: Tthe following will catch command
& menu options to close in your callback procedure
Case %WM_SYSCOMMAND ,tells windows cmd
CANCEL status
Dim x As Long
x = MsgBox( "end app?", %mb_yesno)
Select Case X
Case %IDYES : Function = 0 cancel closure
Case %IDNO : Function = 1 continue with
closure
End Select
Under WM_SYSCOMMAND, the Low 16 bits of wParam (CBWPARAM in DDT-speak)
actually contain the notification....

"Close from system menu or clicking the 'X' in the upper right hand corner"
sends SC_CLOSE notification, so your correct code to test for this is...

CASE %WM_SYSCOMMAND
IF CBWPARAM AND &h00FF = %SC_CLOSE THEN
X = MSGBOX ("End App? ...
yadda yadda


Check your API reference under WM_SYSCOMMAND and you'll see a whole
collection of possible SC_xxxx notifications.. basically anything you see on
the System Menu (close, move, resize, minimize, etc) has a distinct code.

--
Michael Mattias
Tal Systems, Inc.
Racine WI
***@talsystems.com

Loading...