Hello,
I have a browse and four buttoms inside of a dialog and I need to expand the dialog and browse to adjust to screen resolution and move the buttons to other position.
Does somebody know as doing it?
Regards,
Change size to dialog during execution program
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
Hi,
CLASS TDialog FROM TWindow
METHOD Autoresize(ntop,nleft)
METHOD Autoresize(ntop,nleft)
local i,rsl0,rsl1
DEFAULT ntop:=0
DEFAULT nleft:=0
rsl0:=getsysmetrics(0)/800
if rsl0<=1; return ; end //<=800*600, not needed
rsl1:=getsysmetrics(1)/600
for i:=1 TO LEN(::acontrols)
oCtrol = ::aControls
aRect = GetCoors( oCtrol:hWnd )
if oCtrol:classname()=="TCOMBOBOX"
oCtrol:Move( aRect[1]*rsl0, aRect[2]*rsl1)
else
oCtrol:Move( aRect[1]*rsl0, aRect[2]*rsl1, (aRect[4] - aRect[2])*rsl0, (aRect[3] - aRect[1])*rsl1, .t. )
end
next
aRect = GetWndRect( ::hWnd )
::Move( ntop,nleft,::nWidth*rsl0, ::nHeight*rsl1, .T. )
if ::lCentered
WndCenter( ::hWnd )
else
if Empty( ::cResName )
::Move( ::nTop, ::nLeft )
endif
endif
return
In you app
define dialog odlg
redefine controls ...
...
activate dialog odlg on init odlg:autoresize()
Regards,
Shuming Wang
CLASS TDialog FROM TWindow
METHOD Autoresize(ntop,nleft)
METHOD Autoresize(ntop,nleft)
local i,rsl0,rsl1
DEFAULT ntop:=0
DEFAULT nleft:=0
rsl0:=getsysmetrics(0)/800
if rsl0<=1; return ; end //<=800*600, not needed
rsl1:=getsysmetrics(1)/600
for i:=1 TO LEN(::acontrols)
oCtrol = ::aControls
aRect = GetCoors( oCtrol:hWnd )
if oCtrol:classname()=="TCOMBOBOX"
oCtrol:Move( aRect[1]*rsl0, aRect[2]*rsl1)
else
oCtrol:Move( aRect[1]*rsl0, aRect[2]*rsl1, (aRect[4] - aRect[2])*rsl0, (aRect[3] - aRect[1])*rsl1, .t. )
end
next
aRect = GetWndRect( ::hWnd )
::Move( ntop,nleft,::nWidth*rsl0, ::nHeight*rsl1, .T. )
if ::lCentered
WndCenter( ::hWnd )
else
if Empty( ::cResName )
::Move( ::nTop, ::nLeft )
endif
endif
return
In you app
define dialog odlg
redefine controls ...
...
activate dialog odlg on init odlg:autoresize()
Regards,
Shuming Wang
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China