03-17-2013, 12:50 PM
Function dlg_ExternalAppSplitter
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "100 101 5 7"
str e100 e101 c5Not c7Pai
c5Not=1
c7Pai=1
if(!ShowDialog("dlg_ExternalAppSplitter" &dlg_ExternalAppSplitter &controls)) ret
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 227 265 "App Frame"
;100 Edit 0x54231044 0x200 4 16 220 101 ""
;101 Edit 0x54231044 0x200 4 126 222 101 ""
;1 Button 0x54030001 0x4 62 248 48 14 "OK"
;2 Button 0x54030000 0x4 120 248 48 14 "Cancel"
;6 QM_Splitter 0x54000000 0x0 4 118 220 8 ""
;9 QM_Splitter 0x54000000 0x0 4 228 222 2 ""
;5 Button 0x54031003 0x0 44 0 48 14 "Notepad"
;7 Button 0x54031003 0x0 92 0 48 14 "Paint"
;END DIALOG
;DIALOG EDITOR: "" 0x2030502 "*" "" "" ""
;;;;;Action - m (move) or s (resize).
;;;;;Direction - h (horizontally) or v (vertically) or none (horizontally and vertically).
ret
;messages
DT_AutoSizeControls hDlg message "100s 101s 6mh"
DlgSplitter ds1.Init(hDlg 6)
DlgSplitter ds2.Init(hDlg 9)
ARRAY(int)- aw; int- nWindows=2
int i w
sel message
,case WM_INITDIALOG
,aw.create(nWindows)
,run "$system$\notepad.exe" "" "" "" 0x1800 win("Notepad" "Notepad") aw[0]
,run "$system$\mspaint.exe" "" "" "" 0x1800 win("Paint" "MSPaintApp") aw[1]
,for i 0 nWindows
,,SetWindowLong aw[i] GWL_HWNDPARENT hDlg ;;now should always be on top of dialog etc
,SetTimer hDlg 1 100 0
,SendMessage hDlg WM_COMMAND 5 0 ;;execute gButton code. Or use function instead.
,SendMessage hDlg WM_TIMER 1 0 ;;execute gTimer code. Or use function instead.
,
,case WM_TIMER
,sel wParam
,,case 1 goto gTimer
,
,case WM_DESTROY
,for i 0 nWindows
,,clo aw[i]; err
,
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case [5,7] goto gButton
ret 1
;gButton
sel but(5 hDlg)|(but(7 hDlg)<<1)
,case 3
,ds1.SetPos(ds1.GetMaxPos/2)
,ds2.SetPos(ds2.GetMaxPos-20)
,case 1
,ds1.SetPos(ds1.GetMaxPos-30)
,ds2.SetPos(0)
,case 2
,ds1.SetPos(20)
,ds2.SetPos(ds2.GetMaxPos)
,case 0
,ds1.SetPos(20)
,ds2.SetPos(0)
ret
;gTimer
RECT r rr
for i 0 nWindows
,GetWindowRect id(100+i hDlg) &r
,GetWindowRect aw[i] &rr
,if(memcmp(&r &rr sizeof(RECT))) MoveWindow aw[i] r.left r.top r.right-r.left r.bottom-r.top 1
;speed: 6 miscroseconds when don't need to move
ret