Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog hidden to edge
#4
try this out
keep in mind there is presently a bug in qm with the win key
so they actual keys that work are Left,Right,Up,& Down. I have left it with the WL combo as i presume the bug will get fixed
5 hot keys Left,Right,Up,& Down to move dialog to screen edge. end to make dialog like normal in center of screen.

Function DialogShrink
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54030080 0x200 72 52 96 13 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040B01 "*" "" "" ""

str controls = "3"
str e3
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sub.DT_AutoShrink hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAccelerators(hDlg "400 WL[]401 WR[]402 WU[]403 WD[]404 E")
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 400 ;;vertical line on the left edge of the desktop
,PostMessage hDlg WM_APP 1 0
,case 401 ;;vertical line on the right edge of the desktop
,PostMessage hDlg WM_APP 2 0
,case 402 ;;horizontal line on the Top edge of the desktop
,PostMessage hDlg WM_APP 3 0
,case 403 ;;horizontal line on the Bottom edge of the desktop
,PostMessage hDlg WM_APP 4 0
,case 404 ;;restore window to center screen with no shrink
,PostMessage hDlg WM_APP 0 0
ret 1

#sub DT_AutoShrink
/
function# hDlg message wParam lParam

;Adds simple auto-shrink feature for a dialog.
;The dialog must be a smart dialog, ie with dialog procedure.
;Insert the following statement in the dialog procedure, before 'sel message' line:
;DT_AutoShrink hDlg message wParam lParam

int- shrinkMode
type DASDATA !shr RECT'r int'mode
DASDATA* d=+GetProp(hDlg "qm_das")

sel message
,case WM_INITDIALOG
,SetProp hDlg "qm_das" d._new
,if(shrinkMode<>0)
,,goto shrink
,case WM_DESTROY
,d._delete; RemoveProp hDlg "qm_das"
,case [WM_SETCURSOR,WM_PARENTNOTIFY]
,if(d.shr) goto shrink
,case WM_APP
,shrinkMode=wParam
,goto shrink
,case WM_TIMER
,sel wParam
,,case 1578
,,if(win(mouse)!=hDlg and !GetCapture) 
,,,goto shrink
ret

;shrink
RECT r1
d.shr^1
if(d.shr)
,KillTimer hDlg 1578
,GetWindowRect hDlg &d.r
,if(GetWinStyle(hDlg)&WS_CAPTION) SetWinStyle hDlg WS_CAPTION 2
,sel shrinkMode
,,case 1
,,siz 10 0 hDlg 2
,,r1.left=1; r1.top=0
,,AdjustWindowPos hDlg &r1 3        
,,case 2
,,siz 10 0 hDlg 2    
,,r1.left=-1; r1.top=0
,,AdjustWindowPos hDlg &r1 3
,,case 3
,,siz 0 10 hDlg 1
,,r1.left=0; r1.top=1
,,AdjustWindowPos hDlg &r1 3        
,,case 4
,,siz 0 10 hDlg 1
,,r1.left=0; r1.top=-1
,,AdjustWindowPos hDlg &r1 3            
,,case 0
,,SetWinStyle hDlg WS_CAPTION 1
,,siz d.r.right-d.r.left d.r.bottom-d.r.top hDlg
,,r1.left=0; r1.top=0
,,AdjustWindowPos hDlg &r1 3
else
,if(GetWinStyle(hDlg)~WS_CAPTION) SetWinStyle(hDlg WS_CAPTION 1)
,,siz d.r.right-d.r.left d.r.bottom-d.r.top hDlg
,,if(shrinkMode=2)
,,,r1.left=-1; r1.top=0
,,,AdjustWindowPos hDlg &r1 2
,,if(shrinkMode=4)
,,,r1.left=0; r1.top=-1
,,,AdjustWindowPos hDlg &r1 3
,,SetTimer hDlg 1578 100 0


Messages In This Thread
Dialog hidden to edge - by macman - 02-03-2021, 01:15 AM
RE: Dialog hidden to edge - by redbull2k - 02-03-2021, 02:14 AM
RE: Dialog hidden to edge - by macman - 02-03-2021, 03:17 AM
RE: Dialog hidden to edge - by Kevin - 02-04-2021, 01:02 AM
RE: Dialog hidden to edge - by Kevin - 02-04-2021, 01:51 AM
RE: Dialog hidden to edge - by macman - 02-04-2021, 02:49 AM
RE: Dialog hidden to edge - by macman - 02-04-2021, 09:59 AM
RE: Dialog hidden to edge - by Davider - 03-01-2023, 03:34 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)