Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Toolbar vs Dialog, minimizing and closing with apps
#1
Hi,
This is a two-part question. I am using some dialogs as toolbars because the dialog buttons are more flexible in layout and professional looking than the results I get with toolbars. (Maybe I don't know how to master toolbars).

Anyway, with toolbar it is easy to attach to parent window by adding hwnd after mac name
mac "sample toolbar" hwnd.
This will maximize and minimize and close with parent window app.

With dialog, it doesn't seem to work as easily. When I specify hwnd like this:


if(!ShowDialog("SampleTbDlg" &SampleTbDlg hwnd 0 0 0 0 905 27)) ret

the dialog will appropriate minimize and maximize with the hwnd app window, but will still hang on screen after app window is closed.

I saw this in Help file:
Quote:hwndowner - owner window handle. If the dialog is child window (flags includes 1, and style includes WS_CHILD), hwndowner must be parent window handle.

Sometimes dialogs are used as child windows. To create child dialog, when calling ShowDialog specify parent window handle, flag 1 (modeless) and WS_CHILD style.

when I change flag to 1 it doesn't work and there is no WS_CHILD choice in the Dialog Editor Style choices.

Thanks for any advice,

Stuart

p.s. doesn't have to a "smart" dialog - just a simple collection of button triggers but they do have tooltips and it would be nice to have icons which I know how to do with smart dialogs.
THanks again!!.
#2
Use WS_CHILD with ShowDialog style argument. Also remove WS_POPUP style, either in editor or when calling ShowDialog.

You cannot add child dialogs to windows of other threads.

To autoclose nonchild dialog, the dialog function or some other code must detect when the owner window is closed and then close the dialog.

You can place child dialogs on QM toolbars.

Toolbar
Code:
Copy      Help
;/hook ToolbarHookProc2

Function ToolbarHookProc2
Code:
Copy      Help
;/
function# hWnd message wParam lParam

sel message
,case WM_INITDIALOG
,hid id(9999 hWnd)
,ShowDialog("Dialog65" &Dialog65 0 hWnd 1 WS_CHILD WS_POPUP|WS_CAPTION|WS_SYSMENU 0 0 4)
,;the 4 adds 4 pixels at the top where you ca right click or drag the toolbar
,case WM_DESTROY
,

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

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;3 Button 0x54032000 0x0 6 6 48 14 "Button"
;END DIALOG
;DIALOG EDITOR: "" 0x2030003 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,mes 1
ret 1
#3
Fantastico!
Muchos Gracias, amigo!
Stuart
#4
can this be done without using a toolbar, so i can attatch dialogs to windows in exe's
#5
For example, in dialog function you can set 50 ms timer. On timer, detect owner window position and state, and if it changes, change dialog position and state. You can set timer using function SetTimer, there are examples in the forum.
#6
thx gint


Forum Jump:


Users browsing this thread: 7 Guest(s)