PDA

View Full Version : Problems / UI / Dialog Set MinSize



Petr Schreiber
01-09-2008, 02:47
Hi Eros,

I found inconsistency between docs and manifested behaviour.
Docs say DIALOG SET MINSIZE "Set the dialog minimum width and height client area.".
But I suspect it is not client area, but complete window size.

Consider following code:


USES "UI"

DIM hDlg AS DWORD

DIALOG NEW 0, "Minsizer",1,1, 10, 10, _
%WS_POPUP Or %WS_VISIBLE Or _
%WS_CLIPCHILDREN Or %WS_CAPTION OR _
%WS_SYSMENU Or %WS_MINIMIZEBOX or %WS_THICKFRAME, 0 To hDlg



dialog set client hDlg, 400,300 ' <-- with this I can get it smaller ( should not be possible )
'dialog set size hDlg, 400,300 ' <-- with this I cannot :D
dialog set minsize hDlg, 400,300

DIALOG SHOW MODal hDlg, call DlgProc

DIALOG End hDlg

callback function DlgProc() as long

end function


If MINSIZE would be client related, the window could not be made a bit smaller ... but it can be.


Petr

P.S. I think this is the earliest / latest time I ever posted bug description, time to prepare small celebration :D

ErosOlmi
01-09-2008, 07:18
Yes, it is a documentation error.
In reality DIALOG SET MINSIZE ... is used to store info and later handle %WM_GETMINMAXINFO notification: http://msdn.microsoft.com/en-us/library/ms632626(VS.85).aspx
As I can see there, it talks about windows size and not window client area.

I will change thinBasic help file.

Thanks
Eros

ErosOlmi
01-09-2008, 10:01
Next preview refresh will have the following new behave/feature:


dialog set minsize ...
to set the min width/height window size

dialog set minclientsize ...
to set the min width/height client size


Thanks for testing.
Eros

Petr Schreiber
02-09-2008, 10:53
Hi Eros,

in the latest version, DIALOG SET MINCLIENTSIZE works ok, but DIALOG SET MINSIZE still does not work, following dialog can be made a bit smaller.



USES "UI"

DIM hDlg AS DWORD

DIALOG NEW 0, "Minsizer",1,1, 400, 300, _
%WS_POPUP Or %WS_VISIBLE Or _
%WS_CLIPCHILDREN Or %WS_CAPTION OR _
%WS_SYSMENU Or %WS_MINIMIZEBOX or %WS_THICKFRAME, 0 To hDlg

dialog set minsize hDlg, 400,300

DIALOG SHOW MODal hDlg, call DlgProc

DIALOG End hDlg

callback function DlgProc() as long

end function



Thanks,
Petr

ErosOlmi
02-09-2008, 13:28
Petr,

I think it is in reality working fine. The problem is that when the new window is specified having

If the dialog style includes the %WS_CAPTION style, the width and height parameters specify the client size, not including the caption and border size.
If the style does not include %WS_CAPTION, the width and height specify the overall dialog size, including the caption and border, if any.
But this is not documented.

I will see how to arrange it is such a way it is clear how to use. Maybe I will change something in DIALOG NEW to check if %WS_CAPTION style is present and act according.

Thanks
Eros

ErosOlmi
02-09-2008, 16:23
Ok, I think I've got a good compromise.
DIALOG SET MINSIZE will check if client size is different than window size and make the relevant changes to min/max parameters.

Attached a corrected UI modue.

Ciao
Eros

Petr Schreiber
02-09-2008, 18:33
Thanks Eros,

I am sorry, I should study API more to know the trick with ws_caption.
But it is working great now, thanks :).


Petr