//QM v2.9. Do not edit with text editor!!! //
6     2
iIWÈíEC¥Úq—®Ï/thˆLG
!~€p>
  Drag_drop_Dialog  8 35CDF1F7 0
  \Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str e3
if(!ShowDialog("Drag_drop_Dialog" &Drag_drop_Dialog &controls)) ret

 BEGIN DIALOG
 0 "" 0x90CC0A44 0x100 0 0 222 134 "Dialog"
 1 Button 0x54030001 0x4 120 116 48 14 "OK"
 2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
 3 Edit 0x54231044 0x200 4 30 96 48 ""
 4 Static 0x54000000 0x0 4 4 76 22 "Move with Shift[]Resize with Ctrl"
 END DIALOG
 DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
 messages
sel message
	case WM_INITDIALOG
	XML_Get_Data
	case WM_DESTROY
	case WM_COMMAND goto messages2
	
	case WM_SETCURSOR ;;use it to detect left button down. Don't use WM_LBUTTONDOWN because it is sent to the control, not to the dialog.
	sel lParam>>16 ;;mouse message
		case WM_LBUTTONDOWN ;;left down
		sel GetDlgCtrlID(wParam) ;;control id
			case 3 ;;edit control
			int m=GetMod
			sel m
				case [1,2] ;;Shift or Ctrl
				PostMessage hDlg WM_APP wParam m ;;don't use loop on WM_SETCURSOR. Do it async.
				ret DT_Ret(hDlg 1)
	
	case WM_APP
	MoveSizeControlLoop hDlg wParam lParam 1
ret
 messages2
sel wParam
	case IDOK
	case IDCANCEL
ret 1

  XML_Get_Data  8 35CDF2FA 0
str xmlfile="$desktop$\box.xml"
if(!dir(xmlfile)) ret

IXml xml=CreateXml
xml.FromFile(xmlfile)
ARRAY(IXmlNode) a
xml.Path("boxsettings/BoxaA" a)

int i
for i 0 a.len
	IXmlNode& n=a[i]
	str s1=n.ChildValue("p.x")
	str s2=n.ChildValue("p.y")
	str s3=n.ChildValue("p.x-r")
	str s4=n.ChildValue("p.y-r")

int hwnd=win("Dialog" "#32770")

int x=val(s1 2)
int y=val(s2 2)
int cx=val(s3 2)
int cy=val(s4 2)
MoveWindow id(3 win("Dialog" "#32770")) x y cx cy hwnd


  XML_Data_Position  8 35CE0A61 0
int hwnd=win("Dialog" "#32770")
int px py cx cy; GetWinXY id(3 win("Dialog" "#32770")) px py cx cy hwnd
str scx=cx
str scy=cy
str sx=px
str sy=py

str xmlfile="$desktop$\box.xml"
if(!dir(xmlfile))
	_s="<box />"
	_s.setfile(xmlfile)
 
IXml x=CreateXml
 
 
IXmlNode re=x.Add("boxsettings")

IXmlNode e=re.Add("BoxaA")
e.Add("p.x" sx)
e.Add("p.y" sy)
e.Add("p.x-r" scx)
e.Add("p.y-r" scy)
 
str s
x.ToString(s)
out s
 
x.ToFile(xmlfile)


  MoveSizeControlLoop  8 35CE0A25 0
 /
function hDlg hctrl action mouseButton ;;action: 1 move, 2 resize. mouseButton: 1 left, 2 right

MSG m; int mb;

RECT r; GetWindowRect hctrl &r
sel action
	case 1
	POINT po; xm po; po.x-r.left; po.y-r.top ;;get mouse offset in control
	case 2
	mou r.right r.bottom ;;move mouse to right-bottom

int hcur=LoadCursor(0 +IDC_CROSS)

SetCapture(hDlg);
rep
	if(GetCapture()!=hDlg || GetMessage(&m, 0, 0, 0)<=0) break
	if(m.message==WM_KEYDOWN && m.wParam==VK_ESCAPE) ReleaseCapture(); break

	mb=0;
	sel(m.message)
		case WM_MOUSEMOVE:
		POINT p; xm p
		sel action
			case 1
			ScreenToClient hDlg &p
			mov p.x-po.x p.y-po.y hctrl
			str x=p.x
			str y=p.y
			XML_Data_Position		
			case 2
			siz p.x-r.left p.y-r.top hctrl
			str xr=p.x-r.left
			str yr=p.y-r.top
			XML_Data_Position
		SetCursor(hcur);
		continue;
		case WM_LBUTTONUP: mb=MK_LBUTTON
		case WM_RBUTTONUP: mb=MK_RBUTTON

	if(mb==mouseButton)
		ReleaseCapture();

	DispatchMessage(&m);
  file  268500992 0

  