www.icetips.com  Icetips Utilities Documentation 5/15/2016    

Utility Template: Icetips Standardized Window Code Wizard

Previous  Top  Next  


 

This wizard template creates a procedure called WindowInitCode into your application.  If this procedure already exists it will attempt WindowInitCodeA, WindowInitCodeB etc. until it reaches WindowInitCodeZ and then it will fail.

 

This wizard also adds an instance of the "Call procedure from all procedures" global extension template

 

Template_Icetips_Standardized_Window_Co

 

The WindowInitCode procedure is a source procedure that changes how your windows look.  ALL the code is generated into the source procedure so it is entirely up to you how you set it up.

 

Use this wizard along with the "Call procedure from all procedures" global extension template to call this procedure from all window procedures after the window opens.  This will allow you to customize all standard window controls, such as icons on buttons, fonts to use, standard settings for listboxes, etc. etc.  The UtilDemo.app contains a generated  WindowInitCode procedure that gives you an idea how it is used.

 

The default procedure contains setup code for various control types and base controls.  Below is the full procedure code as it is created in build 1.2.2406.  Note that by default the wizard sets button icons to use some of the Roma icons from www.icons-icons.com The icons referenced in the code are all included in the Utilities install in the 3rdParty\Images folder for the old Clarion IDE or accessory\images folder for the new Clarion IDE (Clarion 7, Clarion 8, etc.)  Note that the code uses the GetBaseControlName method which strips the instance number off the control name.  So you don't need to worry about buttons that are called ?Insert:2 or ?Delete:5.  Using '?Insert' and '?Delete' will find any buttons that start with '?Insert' or '?Delete'  This makes it easy to change the look and feel of your application. 
 
This wizard also adds the "Call Procedure from all procedures" global extension template.  This adds a call to this procedure from all your window procedures right after the window has been opened giving this procedure first stab at modifying controls.  On the global extension you can easily exclude procedures from calling the WindowInitCode procedure.  By default it excludes the first procedure as defined in the application properties. 
 
!!! <summary>

!!! Generated from procedure template - Source

!!! Window Standardization Code

!!! </summary>

WindowInitCode       PROCEDURE  (Byte pIsFrame=False)!!,PROC ! Declare Procedure

! Start of "Data Section"

! [Priority 1300]

 

Loc:ClarionBuild     LONG                                  !

! [Priority 4000]

Loc:ListFont     String(64)

Loc:ListFontSize Byte

Loc:ListIsFlat   Byte

 

ITU      ITUtilityClass

I        Long

F        Long

Themed   Byte

L        Byte

CtrlName CString(101)

 

Loc:UseIconsOnButton Byte

 

FEQs    Queue

FEQ       Long

       End

X       Long

 

W      Long

H      Long

Loc:FEQ Long

ClearType  Byte

 

! [Priority 8500]

 

! End of "Data Section"

! Start of "Local Data After Object Declarations"

! [Priority 5000]

 

! End of "Local Data After Object Declarations"

 

CODE

! Start of "Processed Code"

! [Priority 1800]

 

  Loc:ClarionBuild = 8000

! [Priority 4000]

Themed = SYSTEM {PROP:ThemeActive}

ClearType = ITU.UsesClearType()

I = 0

Loc:UseIconsOnButton = True

If Not pIsFrame

  ! Example of setting wallpaper and window icon so the windows can be minimized.

  !0{PROP:Wallpaper} = ''

  !If 0{PROP:RESIZE} = True

  !  0{PROP:Icon}  = '~WindowIcon.ico'

  !End

End

                             ! Example of using INI file to store these settings.

Loc:ListFont     = 'Tahoma'  !GetIni('Window Appearance','Listbox font','Tahoma',INIFileName)

Loc:ListFontSize = 8         !GetIni('Window Appearance','Listbox font size',9,INIFileName)

Loc:ListIsFlat   = True      !GetIni('Window Appearance','Listbox is flat',True,INIFileName)

 

! Read FEQs into queue so they are not affected by processing.

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

 

! Now loop through the queue and check each control.

Loop X = 1 To Records(FEQs)

  Get(FEQs,X)

  I = FEQs.FEQ

  Loc:FEQ = I

  Case I{PROP:Type}

  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

  Of CREATE:String

  OrOf CREATE:SString

    If I{PROP:Background} = COLOR:None

      I{PROP:Trn} = True

    End

  Of CREATE:Prompt

    I{PROP:TRN} = True

  Of CREATE:Option

  OrOf CREATE:Check

    Do CheckCheckRadio

  OrOf CREATE:Group

  OrOf CREATE:Radio

    Do CheckCheckRadio

    I{PROP:TRN} = True

  Of CREATE:Button

    ITU.GetWindowVersion()

    If ITU.UsingLargeFonts()

      ! Using Large Fonts

      If ITU.VersionPlatformID = IT_VER_PLATFORM_WIN32_NT

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

      Else

        I{PROP:FontName} = 'Arial'

      End

      I{PROP:FontSize}  = 8

      I{PROP:FontStyle} = FONT:Regular

    Else

      ! Using Small Fonts

      If ITU.VersionPlatformID = IT_VER_PLATFORM_WIN32_NT

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

      Else

        I{PROP:FontName} = 'Arial'

      End

      I{PROP:FontSize}  = 8

      I{PROP:FontStyle} = FONT:Regular

    End

    If Not pIsFrame

      Do SetButtonIcon

    End

  Of CREATE:Text

    If Themed = False

      I {PROP:Flat} = TRUE

    End

  Of CREATE:Entry

  OrOf CREATE:Spin

    If Themed = False

      I {PROP:Flat} = TRUE

    End

   ! Prevent cleartype problems in entry and spin controls in versions prior to Clarion 7

   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

  Of CREATE:sheet

    I{PROP:Trn} = False

  Of CREATE:Panel

    I{PROP:BevelInner} = 0

    I{PROP:BevelOuter} = 1

  End

End

Free(FEQs)

 

! End of "Processed Code"

! Start of "Procedure Routines"

 

! [Priority 4000]

SetButtonIcon           ROUTINE

!! Remember to add any icons that are used here to the Icons.prj

!! file and recompile the project.

Data

Long

Code

 

I = Loc:FEQ

Case Upper(Clip(ITU.GetBaseControlName(I)))

Of '?SELECT'

  I{Prop:Icon} = '~RO-Mx2_folder-down.ico'

Of '?VIEW'

  I{Prop:Icon} = '~RO-Mx2_folder-up.ico'

Of '?INSERT'

OrOf '?ADD'

  I{Prop:Icon} = '~RO-Mx2_add-green.ico'

Of '?CHANGE'

OrOf '?EDIT'

  I{Prop:Icon} = '~RO-Mx2_notebook-pen.ico'

Of '?DELETE'

  I{Prop:Icon} = '~RO-Mx2_delete.ico'

Of '?CLOSE'

OrOf '?CANCEL'

  I{Prop:Icon} = '~RO-Mx2_door-2.ico'

Of '?OK'

  I{Prop:Icon} = '~RO-Mx2_checkmark-green.ico'

Of '?CALENDAR'

  I{Prop:Icon} = '~RO-Mx2_calendar-month-2.ico'

End

 

If I{Prop:Icon}

  I{Prop:Left} = True

Else

  I{Prop:Left} = False

End

I{Prop:Flat} = False

 

 

 

! [Priority 4000]

CheckCheckRadio             ROUTINE

Data

String(20)

Code

 

Case Loc:FEQ

Of CREATE:Check

OrOf CREATE:Radio

  T = Loc:FEQ{Prop:Text}

  If T

    If T[1] <> ' '

      Loc:FEQ{Prop:Text} = ' ' & Loc:FEQ{Prop:Text}

    End

  End

End

 

! [Priority 8500]

 

! End of "Procedure Routines"

! Start of "Local Procedures"

! [Priority 5000]

 

! End of "Local Procedures"



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