I'm building a little catalog app and want to use a captionless dialog but it needs to be movable.
All the item info is in images but they have to be .png format so as far as I can tell I'm stuck using SHDocVw.WebBrowser control to display the images.
I've got the dialog with the control setup no problem but you can't move a captionless window and this just does not look as good as it does captionless.
I found the following example here but I can't figure out how to get it to work.
to start my smart dialog, tried it to start the macro then called from another mac...I even tried calling the function after a case WM_LBUTTONDOWN event. All I ended up doing was setting a hook at some point that ate all the left mouse events in the QM editor and I had to restart. :?
I'm thinking this might be a bit more of a pain to do because I'm running the dialog as transparent.
The dialog function is almost the same as the toolbar hook function, so any additional hooking is not needed. Anyway there is an easy to use function for moving dialogs:
Works great in the example but the browser control is eatting the mouse clicks and in my app the control is actually bigger than the dialog so there is no dialog to click on.
Is there a child/parent relationship I don't have set correctly or any other way this might work?
;Moves the dialog when the user presses left mouse button on the client area and drags.
;Returns 1 if suscessful, 0 if not (then the message should be passed to the default window procedure).
;The dialog must be a smart dialog, ie with dialog procedure.
;Call this function from the dialog procedure as shown below:
;To enable moving the dialog by dragging a control, call DialogDragSubclassControl on WM_INITDIALOG.
;If the control has scroll bars, use Ctrl or other modifier key to scroll.
dll user32 #DragDetect hwnd POINT'pt
POINT-- pp_drag POINT p RECT r int-- t_indrag
sel message ,case WM_LBUTTONDOWN ,t_indrag=0 ,if(GetMod!=modifiers) ret ,if(GetWinStyle(hDlg)&WS_CHILD) ;;need to detect drag, or the control will not respond to clicks ,,xm p ,,if(!DragDetect(hDlg p)) ,,,ScreenToClient hDlg &p ,,,PostMessage hDlg WM_LBUTTONUP 0 p.y<<16|p.x ,,,ret ,xm pp_drag ,SetCapture hDlg ,t_indrag=1 , ,case [WM_LBUTTONUP,WM_CANCELMODE] ,if(!t_indrag or GetCapture!=hDlg) ret ,ReleaseCapture ,t_indrag=0 , ,case WM_MOUSEMOVE ,if(!t_indrag or GetCapture!=hDlg) ret ,hDlg=GetAncestor(hDlg 2) ;;in case hDlg is a subclassed control ,GetWindowRect hDlg &r ,xm p ,mov r.left+p.x-pp_drag.x r.top+p.y-pp_drag.y hDlg ,pp_drag=p
ret ;messages sel message ,case WM_INITDIALOG ,DT_Init(hDlg lParam) ;;* ,;subclass web browser ,int hctrl=child("" "Internet Explorer_Server" id(3 hDlg)); if(!hctrl) out "Warning: Web browser control not initialized. Assign an url or ''about:blank'' to the control variable before ShowDialog."; ret ,DialogDragSubclassControl hctrl ,ret 1 ;;* ,case WM_DESTROY DT_DeleteData(hDlg) ;;* ,case WM_COMMAND goto messages2 ,;case [WM_LBUTTONDOWN,WM_LBUTTONUP,WM_MOUSEMOVE,WM_CANCELMODE] DragDialog hDlg message ;;this also can be used ret ;messages2 sel wParam ,case IDOK ,DT_Ok hDlg ;;* ,case IDCANCEL DT_Cancel hDlg ;;* ret 1
And I don't know how to say this but....it's still not working.
I've modified nothing just copy/paste escaped all those functions.
Example one works fine.
Example two when I click on the "drag me" button it kinda blinks a few times then disapears and the only way to drag that example is via the caption bar dragging the client area does not work.
Example three will not drag at all and generates the "Warning" msg in QM output even though I've changed nothing and google loads.
I'm using QM 2.2.0.7 and have noticed some "quirkyness" if you will since upgrading. For instance sometimes when clicking the run button to start a macro it just hangs. The QM icon goes red but the macro never starts. Killing the thread and starting it again always works.
Or a new problem thats just developed is if I click the run button to edit a smart dialog its not working and only on some dialogs others work fine. I've triple checked the code and they all start the same with dialog procedures. I was going to start a new thread but now I'm wondering if this has something to do with it? Should I reinstall or maybe revert versions?
Thank you for all the help Gintaras (you too _pi)!
Quote:Example two when I click on the "drag me" button it kinda blinks a few times then disapears and the only way to drag that example is via the caption bar dragging the client area does not work.
Sounds like you call DialogDragSubclassControl but still use old DialogDrag. Then instead of moving dialog is moved control, and it disappears. New DialogDrag cannot move controls because it gets dialog handle using GetAncestor before moving.
Quote:Example three will not drag at all and generates the "Warning" msg in QM output even though I've changed nothing and google loads.
Maybe it depends on IE version. I tested with IE7. If the message is displayed, it means that the page is still not loaded at that time, and Internet Explorer_Server child window is still not created. Try to use "about:blank" before ShowDialog (instead of google url), and on WM_INITDIALOG use _s.setwintext(id(3 hDlg) "http://www.google.com").
Quote:I'm using QM 2.2.0.7 and have noticed some "quirkyness" ...
Don't know what it could be. Try to install QM 2.2.0.8.
Quote:when clicking the run button to start a macro it just hangs. The QM icon goes red but the macro never starts. Killing the thread and starting it again always works.
Quote:when clicking the run button to start a macro it just hangs. The QM icon goes red but the macro never starts. Killing the thread and starting it again always works.
Does it can happen with any macro?
I'll have to try running some of the standard macros more to test when I have a chance.
Dialog Editor starts only if the function begins with space or semicolon. It is in all QM versions. It is a quick way to switch between dialog design and run mode - right click the selection bar before \Dialog_Editor. If it begins with space, starts dialog editor, else runs the function.
I replaced code in previous post (all three functions). Now can be set modifier keys. Use 2 as third argument of DragDialog (if using dialog to drag) or/and as second argument of DragDialogSubclassControl (if using a control to drag).