www.icetips.com  Icetips Utilities Documentation 11/30/2010    

Example Program: WindowInitCode

Previous  Top  Next  


This procedure is an example of how you can standardize various parts of your application from a single procedure.  This procedure is called from all window procedure by using the "Call procedure from all procedures" Global extension template.  This procedure uses a local queue to store all control FEQs in it.  This is done to prevent any possible problems with certain properties altering the processing order of controls, which can happen when certain properties are changed.  This is done with the following example code:

 

Loop

  I = 0{PROP:NextField,I}

  If Not I

    Break

  End

  If Not pIsFrame

    If I < 0

      Cycle

    End

  End

  FEQs.FEQ = I

  Add(FEQs)

End

 

Then this queue is processed and each controls is checked for it's type:

 

Loop X = 1 To Records(FEQs)

  Get(FEQs,X)

  I = FEQs.FEQ

  Loc:FEQ = I

  Case I{PROP:Type}

  ...

End

 

Each control type get's specific settings, such as this section for various listbox types:

 

  Of CREATE:List

    I{PROP:FontName} = 'Tahoma'

    I{PROP:FontSize} = 9

    F = 0

    Loop

      F += 1

      If Not I{PROPLIST:Exists,F}

        Break

      End

      I{PROPLIST:HeaderCenter,F} = True

      ! Right adjust decimal adjusted fields and set offset to 2

      If I{PROPLIST:Decimal,F} = True

        I{PROPLIST:Right,F} = True

        I{PROPLIST:RightOffset,F} = 2

      End

    End

  OrOf CREATE:DropList

  OrOf CREATE:DropCombo

  OrOf CREATE:Combo

    I{PROP:Flat}    = True

    I{PROP:Vscroll} = True

    If I{PROP:Drop} > 0

      I{PROP:VCR}        = False

    Else

      I{PROP:VCR}        = True

    End

    I {PROP:FontName} = Loc:ListFont

    I {PROP:FontSize} = Loc:ListFontSize

 

And this part that deals with entry and spin fields:

 

  Of CREATE:Entry

  OrOf CREATE:Spin

    If Themed = False

      I {PROP:Flat} = TRUE

    End

    If ClearType  And Loc:ClarionBuild < 7000

      I{PROP:FontName} = 'MS Sans Serif'

    End

    I{PROP:FontSize} = 8

    If I{PROP:Decimal} = True Or Instring('D',Upper(I{PROP:Text}),1,1) = 1

      I{PROP:Right}      = True

      I{PROP:RightOffset} = 1

    End

 

In this case it changes the font name if the user is using ClearType and if this is compiled with Clarion prior to version 7.0  Clarion 6.3 has problems with TrueType fonts when used with ClearType, so we change the font to MS Sans Serif which is a bitmap font and works fine.  May not look the best, but it beats chopped up character which you will get if you use TrueType fonts with ClearType!

 

See also:

Call procedure from all procedures

 

 

 



Direct link to this page: http://www.icetips.com/manuals/utilities/windowinitcode.htm