Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog Questions - dbl click, modifier click
#1
A few dialog questions:

1. How to make a button respond only to double-click and not single?

2. How to trigger action upon click (or better, double-click) of a bmp in dialog, or do I need to convert to button with bmp on it?

3. I have a User Config function/dialog that I want to be opened (if desired by user) from within the Main Macro/Data Entry dialog.

The trouble is that once changes have been made in the User Config, the Main Macro (caller) must be restarted in order to reload a slew of INI values etc. Is calling the UserConfig with "mac- UserConfig" and then have the last line of UserConfig run "mac- MainMacro" the the best way to do this? Or should I just try to re-declare, re-read all the info without ever ending anything?

Thanks for your help!
#2
1. Difficult.
2. Add SS_NOTIFY style. Then you can use the control like a button.
3.

Don't use mac. Call ShowDialog for the dialog2 from the dialog1. Then close dialog1 and run the function that shows it.

,if(!ShowDialog("dialog2" ...)) ret
,clo hDlg
,mac "dialog1"

It is probably the easiest of all possible ways.
#3
2. I tried a few examples without any luck. Can you please give small example of ss_notify use in dialog?

\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

BEGIN DIALOG
0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
1 Button 0x54030001 0x4 120 116 48 14 "OK"
2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
3 Static 0x5400100E 0x20000 32 16 140 74 ""
END DIALOG
DIALOG EDITOR: "" 0x2030001 "" "" ""
out
str controls = "3"
str sb3 = "$windows$\Greenstone.bmp"
if(!ShowDialog("DlgSS3" &DlgSS3 &controls)) ret


ret
messages
sel message
case WM_INITDIALOG
case WM_DESTROY
case WM_COMMAND goto messages2
ret
messages2
sel wParam
case STN_CLICKED<<16|3

case IDOK
case IDCANCEL
ret 1



3.Ahhh, thank you. Much better method.
#4
2. I tried a few examples without any luck. Can you please give small example of ss_notify use in dialog?

Function DlgSS3
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Static 0x5400100E 0x20000 32 16 140 74 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""
out
str controls = "3"
str sb3 = "$windows$\Greenstone.bmp"
if(!ShowDialog("DlgSS3" &DlgSS3 &controls)) ret


ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case STN_CLICKED<<16|3

,case IDOK
,case IDCANCEL
ret 1


3.Ahhh, thank you. Much better method.
#5
SS_NOTIFY style was not added

Function DlgSS3
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Static 0x5400110E 0x20000 32 16 140 74 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030003 "" "" ""
out
str controls = "3"
str sb3 = "$windows$\Greenstone.bmp"
if(!ShowDialog("DlgSS3" &DlgSS3 &controls)) ret


ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case STN_CLICKED<<16|3
,mes 1
,
,case IDOK
,case IDCANCEL
ret 1
#6
Quote:SS_NOTIFY style was not added

1. I don't see where you added this, or how I will know how to do in the future. Obviously you added an action (mes 1) after case which I forgot to put in in my original, but what else changed that equals "adding SS_NOTIFY style" and how?

I see that these two lines changed from:

3 Static 0x5400100E 0x20000 32 16 140 74 ""
END DIALOG
DIALOG EDITOR: "" 0x2030001 "" "" ""

To:

3 Static 0x5400110E 0x20000 32 16 140 74 ""
END DIALOG
DIALOG EDITOR: "" 0x2030003 "" "" ""

Is this why it works now?

2. I forgot to ask in original post, is it possible to add a modifier key to a button click in a dialog (e.g., CTL or ALT Click)?
#7
1. in dialog editor
2. use ifk or GetMod
#8
I'm an idiot. I was thinking "Events", as in button click.

Thanks.
#9
I have lots of double and triple clicks for my dialog buttons and toolbar items --
just add the following to the first line of the function being called and change the mes statements to whatever function or macro you want...

Function SingleDoubleTripleQuadClick
Code:
Copy      Help
wait 0.3 ML; err mes "single click"; ret;; if no click in 0.3 sec then user intended single click
wait 0.3 ML; err mes "double click"; ret ;; if no click in 0.3 sec then user intended double click
wait 0.3 ML; err mes "triple click"; ret ;; if no click in 0.3 sec then user intended triple click
mes "quadruple click"

make sure that you have it set as "Allow only single instance" in function properties and it should work great.

Stuart
#10
Hi,
I was wondering if there was something like

Code:
Copy      Help
case STN_CLICKED<<16|3
but for a richedit or regular edit box in a dialog. I have a scrolling readonly richedit text box which is in a small dialog. So the user has to scroll a lot to get through the entire text. I want that if the user clicks on the text box, it will get larger. I could easily do this with an additional button, but it would be cleaner if the user just clickon the text to toggle the size.
Thanks,

Stuart
#11
case WM_SETCURSOR

To see what messages your dialog receives, use __OutWinMsg in dialog function:
Code:
Copy      Help
;messages
__OutWinMsg message wParam lParam
sel message

or Spy++.
#12
phenomenal!!!
A great way to learn how to really really understand dialogs!
THanks, STuart


Forum Jump:


Users browsing this thread: 1 Guest(s)