PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Douglas McDonald on March 06, 2013, 06:43:57 PM

Title: resize window created by CreateWindowEx
Post by: Douglas McDonald on March 06, 2013, 06:43:57 PM
I saw this code Paul posted but I get an error 480 parameter mismatch highlighted on 'resize rules

   ' Create and format the MLG grid
   sSetup = "r60/c13/d2/h1/f3/z1" '& _
           ' "x50,100,100,100,120,200,200/" & _
           ' "j1Column1,Column2,Column3,Column4,Column5,Column6"
   
   hWndGridAS = CreateWindowEx( %WS_EX_LEFT Or %WS_EX_LTRREADING Or %WS_EX_RIGHTSCROLLBAR , _
                              ByCopy "MYLITTLEGRID", _
                              ByCopy sSetup, _
                              %WS_CHILD Or %WS_VISIBLE Or %WS_TABSTOP, _
                              90, 104, 700, 486, _
                              hWndParent, _
                              %ID_GRID_AS, _
                              App.hInstance, _
                              ByVal %Null )
   'add resize
   nResult = FLY_SetControlData( hWndGridAS, _                          ' Handle of the control
                                   %FALSE, _                              ' Subclass the control?
                                   %TRUE, _                               ' Allow setting of the font
                                   "Calibri, -13, 0, 0, 0, 0", _   ' font
                                   0, _                                   ' ControlIndex
                                   %FALSE, _                              ' Allow processing of color
                                   %FALSE, _                              ' Is the specified foreground color a system color?
                                   %FALSE, _                              ' Is the specified background color a system color?
                                   0, _                                   ' Foreground color
                                   0, _                                   ' Background color
                                   -1, _                                  ' Transparent brush
                                   CodePtr(ASTRCU_CODEPROCEDURE),_           ' code procedure
                                   "S,S,S,S")                     ' Resize rules  [color=red]gets error[/color]
 

I assume FORM1_CODEPROCEDURE is replaced by my form's namr, ASTRCU as above

Thoughts?

Thanks
Doug
Title: Re: resize window created by CreateWindowEx
Post by: Douglas McDonald on March 06, 2013, 07:12:20 PM
Ok I have to add %false after "S,S,S,S"

Still it acts pretty flaky. Its hard to enplane. When resizing one of my buttons gets to about 3/4 the size of the form and I can see the button text. Hides everything behind it and keeps flashing.
Title: Re: resize window created by CreateWindowEx
Post by: Douglas McDonald on March 08, 2013, 09:40:34 AM
Is there a better way to resize MLG? Also what exactly if anything should be in the WM_size routine?

Thanks
Doug
Title: Re: resize window created by CreateWindowEx
Post by: Paul Squires on March 08, 2013, 02:06:35 PM
Hi Doug - I rarely (if ever) use the scale option because I don't want my controls to lose their size as a Form grows or shrinks. I usually use the optiosn that control the movement of the control. For example, tie the left & right edges of the control to the right edge of a Form so that when the Form grows then the control moves with it.

For resizing the MLG I would simply use the WM_SIZE handler and either the WinAPI command MoveWindow or (my favourite) SetWindowPos. You could also use FireFly's builtin functions for setting location.

Not sure how you want your grid to react to Form resizing so it is hard to really give exact advice.

Title: Re: resize window created by CreateWindowEx
Post by: Douglas McDonald on March 15, 2013, 10:42:31 AM
Thanks Paul, I can take from here.

Doug