resize window created by CreateWindowEx

Started by Douglas McDonald, March 06, 2013, 06:43:57 PM

Previous topic - Next topic

Douglas McDonald

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
Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?

Douglas McDonald

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.
Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?

Douglas McDonald

Is there a better way to resize MLG? Also what exactly if anything should be in the WM_size routine?

Thanks
Doug
Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?

Paul Squires

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.

Paul Squires
PlanetSquires Software

Douglas McDonald

Doug McDonald
KD5NWK
www.redforksoftware.com
Is that 1's and 0's or 0's and 1's?