Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Forms and screen resolution
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01396126
Message ID:
01396546
Views:
106
Naomi, I noticed you've moved away from NY to the midwest, that's a big change for you!

As for the form, I have created the class and started a new form. I've cut and pasted the controls from the old
form to new one then ran it. This is where the errors saying those properties cannot be found. No sense to me.




>Hi Timothy,
>
>Sorry, I don't have an access to computer these few days. Anyway, to me this sounds like you may want to create a form class and base your forms on this class. If you already have a base form class perhaps you can just add this functionality to your existing class.
>
>>Naomi, I decided to use the code below to resize, my quest is how do I actually implement this code into a form? Don't I need a vcx? I need to be able to drop it into a form?
>>
>>**************************************************
>>*-- Class:        frmmaximize
>>*-- ParentClass:  form
>>*-- Self maximizing form for sovereign applications
>>*
>>
>>oform1=CREATEOBJECT("fmax")
>>susp
>>oform1.Show()
>>
>>
>>Define Class fmax As Form
>>  DoCreate = .T.
>>  *-- SYSMETRIC( 1 ) / 640
>>  widthratio = 0
>>  *-- SYSMETRIC( 2 ) / 480
>>  heightratio = 0
>>  Name = "fmax"
>>  
>>  
>>  
>>  
>>  *-- Drill down into pageframes, pages, grids, etc on the form and resize all of the controls
>>  Procedure resizecontrols
>>    Lparameters toControl
>>    Local loPage, loControl, loColumn, lnColumnWidths[1], lnCol
>>
>>    If Pemstatus( toControl, 'Width', 5 )
>>      toControl.Width = toControl.Width * Thisform.widthratio
>>    Endif
>>    If Pemstatus( toControl, 'Height', 5 )
>>      toControl.Height = toControl.Height * Thisform.heightratio
>>    Endif
>>    If Pemstatus( toControl, 'Top', 5 )
>>      toControl.Top = toControl.Top * Thisform.heightratio
>>    Endif
>>    If Pemstatus( toControl, 'Left', 5 )
>>      toControl.Left = toControl.Left * Thisform.heightratio
>>    Endif
>>    *** Now resize the font of the control, grid (naturally <g>) is a special case because
>>    *** resizing the font resizes the column widths of the grid, so save and restore them
>>    If Upper( Alltrim( toControl.BaseClass ) ) = 'GRID'
>>      Dimension lnColumnWidths[toControl.ColumnCount]
>>      For lnCol = 1 To toControl.ColumnCount
>>        lnColumnWidths[lnCol] = toControl.Columns[lnCol].Width
>>      Endfor
>>      toControl.FontSize = Int( toControl.FontSize * Thisform.widthratio )
>>      For lnCol = 1 To toControl.ColumnCount
>>        toControl.Columns[lnCol].Width = lnColumnWidths[lnCol]
>>      Endfor
>>    Else
>>      If Pemstatus( toControl, 'Fontsize', 5 )
>>        toControl.FontSize = Int( toControl.FontSize * Thisform.widthratio )
>>      Endif
>>    Endif
>>    Do Case
>>      Case Upper( toControl.BaseClass ) = 'PAGEFRAME'
>>        For Each loPage In toControl.Pages
>>          Thisform.resizecontrols( loPage )
>>        Endfor
>>
>>      Case Inlist( Upper( toControl.BaseClass ), 'PAGE', 'CONTAINER' )
>>        For Each loControl In toControl.Controls
>>          Thisform.resizecontrols( loControl )
>>        Endfor
>>
>>      Case Upper( toControl.BaseClass ) = 'GRID'
>>        With toControl
>>          .RowHeight     = .RowHeight * Thisform.heightratio
>>          .HeaderHeight  = .HeaderHeight * Thisform.heightratio
>>          For Each loColumn In .Columns
>>            loColumn.Width = loColumn.Width * Thisform.widthratio
>>          Endfor
>>        Endwith
>>
>>      Case Inlist( Upper( toControl.BaseClass ), 'COMBOBOX', 'LISTBOX' )
>>        Local lnCol, lnStart, lnEnd, lnLen, lcColumnWidths
>>        With toControl
>>          If .ColumnCount < 2
>>            .ColumnWidths = Alltrim( Str( .Width ) )
>>          Else
>>            lcColumnWidths = ''
>>            lnStart = 1
>>            For lnCol = 1 To .ColumnCount - 1
>>              lnEnd = At( ',', .ColumnWidths, lnCol )
>>              lnLen = lnEnd - lnStart
>>              lcColumnWidths = lcColumnWidths + Iif( Empty( lcColumnWidths ), '', ',' ) + Alltrim( Str( Val (Substr( .ColumnWidths, lnStart, lnLen ) ) * Thisform.widthratio ) )
>>              lnStart = lnEnd + 1
>>            Endfor
>>            lnLen = Len( .ColumnWidths ) - lnStart + 1
>>            lcColumnWidths = lcColumnWidths + ',' + Alltrim( Str( Val (Substr( .ColumnWidths, lnStart, lnLen ) ) * Thisform.widthratio ) )
>>            .ColumnWidths = lcColumnWidths
>>          Endif
>>        Endwith
>>
>>      Case Inlist( Upper( Alltrim( toControl.BaseClass ) ), 'COMMANDGROUP', 'OPTIONGROUP' )
>>        Local lnButton
>>        For lnButton = 1 To toControl.ButtonCount
>>          Thisform.resizecontrols( toControl.Buttons[lnButton] )
>>        Endfor
>>
>>      Otherwise
>>        *** There is no otherwise...I think we got all cases
>>    Endcase
>>  Endproc
>>
>>
>>  Procedure Init
>>    Local loControl
>>
>>    With Thisform
>>      *** Determine the ratio needed to maximize the form
>>      *** depending on screen resolution and store it to form properties
>>      .widthratio = Sysmetric( 1 ) / 640
>>      .heightratio = Sysmetric( 2 ) / 480
>>      *** If resolution is higher than 640 x 480, reposition
>>      *** and maximize the form
>>      If .widthratio > 1
>>        .Top = 0
>>        .Left = 0
>>        .Width = .Width * .widthratio
>>        .Height = .Height * .heightratio
>>        *** And resize each control contained in the form
>>        For Each loControl In .Controls
>>          .resizecontrols( loControl )
>>        Endfor
>>      Endif
>>    Endwith
>>  Endproc
>>
>>
>>Enddefine
>
"Build a man a fire, and he's warm for a day.
Set a man on fire, and he's warm for the rest of his life."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform