Announcement

Collapse
No announcement yet.

Special Sale on EZGUI 4.0 Pro ! (Save $70)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Chris Boss
    replied
    Sale is over

    Sale is now over.

    Leave a comment:


  • Chris Boss
    replied
    Only a few hours left for this sale.

    Leave a comment:


  • Chris Boss
    replied
    Only a day and half left on this sale.

    Leave a comment:


  • Chris Boss
    replied
    Let's take another example.

    Task:
    • Create a Rich Text Editor which can:
    • Open, Display, Edit and Save RTF files
    • Allow real time editing of character fonts, colors, styles
    • display real font, color and style of text at current caret position
    • Font Combobox displays what fonts actually look like
    • Color Combobox displays what colors actually look like
    • Editor Dialog will have a Toolbar for common file tasks
    • Editor Dialog will have a second bar of controls for text editing
    • Both Toolbar and Control Bar displayed on a rebar control so they can be moved (swap positions)
    • Provide Printer Setup Dialog
    • Provide Printing Dialog (actually prints RTF file to printer)
    • Priovide Print Preview Dialog
    Lets' look at the actual program with some screenshots:






    Oh, yes, I forgot. Let's make the button controls 3D ownerdrawn buttons (which can change their colors based on the state of the RTF texts attributes).

    Now how complex would this program be using the Windows API ?

    Let's see how it looks using EZGUI 4.0 Pro: (some remarks removed)

    Code:
    #COMPILE EXE
    #DIM ALL        '   This is helpful to prevent errors in coding
    ' --------------------
    #INCLUDE "C:\ezgui40pro\includes\ezgui40.inc"                          ' EZGUI Include file for Declares
    ' --------------------
    DECLARE FUNCTION Main_Initialize(BYVAL VerNum&) AS LONG
    DECLARE SUB OtherForm_Events(FormName$, CID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB OtherForm_Design(FormName$)
    DECLARE FUNCTION PreProcess_Events(FormName$, CID&, CMsg&, CVal&, Cancel&) AS LONG
    DECLARE SUB EZ_MDIPARENT_Display(BYVAL Parent$)
    DECLARE SUB EZ_MDIPARENT_Design()
    DECLARE SUB EZ_MDIPARENT_ParseEvents(CID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MDIPARENT_Events(CID&, CMsg&, CVal&, Cancel&)
    ' ----------------------------------------------------------
    %MDIPARENT_MENUFILES                              = 9000
    ' ----------------------------------------------------------
    %MDIPARENT_MENUNEW                                = 9005
    %MDIPARENT_MENUOPEN                               = 9010
    %MDIPARENT_MENUSAVE                               = 9015
    %MDIPARENT_MENUCLOSE                              = 9020
    %MDIPARENT_SEPARATOR_9025                         = 9025
    %MDIPARENT_MENUPSETUP                             = 9030
    %MDIPARENT_MENUPRINT                              = 9035
    %MDIPARENT_MENUPPREVIEW                           = 9040
    %MDIPARENT_SEPARATOR_9045                         = 9045
    %MDIPARENT_MENUEXIT                               = 9050
    ' ----------------------------------------------------------
    %MDIPARENT_MENUEDIT                               = 9100
    ' ----------------------------------------------------------
    %MDIPARENT_MENUCOPY                               = 9105
    %MDIPARENT_MENUCUT                                = 9110
    %MDIPARENT_MENUPASTE                              = 9115
    ' ----------------------------------------------------------
    %MDIPARENT_MENUWIN                                = 9200
    ' ----------------------------------------------------------
    %MDIPARENT_MENUTILE                               = 9205
    %MDIPARENT_REBAR1             = 100
    %MDIPARENT_MDICLIENT1         = 25
    %MDIPARENT_STATUSBAR          = 110
    DECLARE SUB MDIPARENT_REBAR1_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB EZ_MDICHILD_Display(BYVAL Parent$, BYVAL AC!, BYVAL AR!)
    DECLARE SUB EZ_MDICHILD_Design()
    DECLARE SUB EZ_MDICHILD_ParseEvents(CID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MDICHILD_Events(CID&, CMsg&, CVal&, Cancel&)
    ' ------------------------------------------------
    %MDICHILD_TEXT1              = 100
    DECLARE SUB MDICHILD_EditSetSel(BYVAL CVal&)
    DECLARE SUB MDICHILD_TEXT1_Load(BYVAL Mode&, BYVAL D$)
    DECLARE SUB MDICHILD_TEXT1_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB MDICHILD_TEXT1_EditSetSel(BYVAL CVal&)
    DECLARE SUB MDICHILD_TEXT1_SubClass(BYVAL CVal&, Cancel&)
    DECLARE SUB EZ_PPFORM_Display(BYVAL Parent$)
    DECLARE SUB EZ_PPFORM_Design()
    DECLARE SUB EZ_PPFORM_ParseEvents(CID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB PPFORM_Events(CID&, CMsg&, CVal&, Cancel&)
    ' ------------------------------------------------
    %PPFORM_NEXTPAGE           = 100
    %PPFORM_PREVPAGE           = 105
    %PPFORM_PRINTPAGE          = 110
    %PPFORM_CLOSEPREVIEW       = 115
    %PPFORM_LABEL1             = 120
    %PPFORM_CANVAS1            = 125
    DECLARE SUB PPFORM_NEXTPAGE_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB PPFORM_PREVPAGE_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB PPFORM_PRINTPAGE_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB PPFORM_CLOSEPREVIEW_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB PPFORM_CANVAS1_Draw(BYVAL Mode&)
    DECLARE SUB EZ_TBAR1_Display(BYVAL FormName$, BYVAL RebarID&, BYVAL BText$, BYVAL ImgIndex&, BYVAL HWidth&, BYVAL BGPict$, BYVAL BProp$)
    DECLARE SUB EZ_TBAR1_Design()
    DECLARE SUB EZ_TBAR1_ParseEvents(CID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB TBAR1_Events(CID&, CMsg&, CVal&, Cancel&)
    ' ------------------------------------------------
    %TBAR1_TOOLBAR1           = 50
    DECLARE SUB TBAR1_TOOLBAR1_Events(BYVAL TBarID&, MyID&, BYVAL ButtonN&, CMsg&, CVal&, Cancel&)
    DECLARE SUB EZ_TBAR2_Display(BYVAL FormName$, BYVAL RebarID&, BYVAL BText$, BYVAL ImgIndex&, BYVAL HWidth&, BYVAL BGPict$, BYVAL BProp$)
    DECLARE SUB EZ_TBAR2_Design()
    DECLARE SUB EZ_TBAR2_ParseEvents(CID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB TBAR2_Events(CID&, CMsg&, CVal&, Cancel&)
    ' ------------------------------------------------
    %TBAR2_BOLDBUTTON         = 100
    %TBAR2_ITALICBUTTON       = 105
    %TBAR2_UNDERBUTTON        = 110
    %TBAR2_FONTNAMES          = 115
    %TBAR2_FONTSIZES          = 120
    %TBAR2_FONTCOLORS         = 125
    %TBAR2_LEFTBUTTON         = 130
    %TBAR2_CENTERBUTTON       = 135
    %TBAR2_RIGHTBUTTON        = 140
    DECLARE SUB TBAR2_BOLDBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB TBAR2_ITALICBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB TBAR2_UNDERBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB TBAR2_FONTNAMES_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB TBAR2_FONTSIZES_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB TBAR2_FONTCOLORS_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB TBAR2_LEFTBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB TBAR2_CENTERBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB TBAR2_RIGHTBUTTON_Events(MyID&, CMsg&, CVal&, Cancel&)
    ' --------------------
    #INCLUDE "C:\ezgui40pro\includes\ezwmain.inc"                          ' EZGUI Include file for WinMain
    ' --------------------
    '<<SAVE>>
    GLOBAL App_BoldState&
    GLOBAL App_ItalicState&
    GLOBAL App_UnderState&
    GLOBAL App_FontName$
    GLOBAL App_FontSize!
    GLOBAL App_FontProp$
    GLOBAL App_FontColor&
    GLOBAL App_LeftAlign&
    GLOBAL App_CenterAlign&
    GLOBAL App_RightAlign&
    GLOBAL App_CurrentPage&
    GLOBAL App_PageCount&
    '<<END>>
    '
    SUB EZ_Main(VerNum&)     ' (PROTECTED)
         EZ_Reg %EZ_CUSTID,%EZ_REGNUM
         EZ_DefImageFolder "Graphics"
         EZ_AllowCommandEvents  0
         EZ_LoadImageLib ""
         EZ_DefFont 6, "Arial", 10, "V"
         EZ_DefFont 7, "Courier New", 10, "F"
         EZ_DefFont 8, "Times New Roman", 10, "V"
         EZ_DefFont 9, "Modern", 10, "V"
         EZ_DefSystemColor 32, 16
         EZ_DefSystemColor 33, 21
         EZ_DefSystemColor 34, 15
         EZ_DefSystemColor 35, 18
         EZ_DefColorL 36, &HB96FFF
         EZ_DefColorL 37, &H14AB9F
         EZ_DefColorL 38, &H47A7FF
         EZ_DefColorL 39, &HD2AACF
         EZ_DefColorL 40, &H1CD5E3
         EZ_DefColorL 41, &HBC8943
         EZ_DefColorL 42, &H6C6AB7
         EZ_DefColorL 43, &HDD4489
         IF Main_Initialize(VerNum&) THEN
              EZ_MDIPARENT_Display ""
         END IF
    END SUB
    '
    SUB EZ_DesignWindow(FormName$)     ' (PROTECTED)
         SELECT CASE FormName$
              CASE "MDIPARENT"
                   EZ_MDIPARENT_Design
              CASE "MDICHILD"
                   EZ_MDICHILD_Design
              CASE "PPFORM"
                   EZ_PPFORM_Design
              CASE "TBAR1"
                   EZ_TBAR1_Design
              CASE "TBAR2"
                   EZ_TBAR2_Design
              CASE ELSE
                   OtherForm_Design FormName$
         END SELECT
    END SUB
    '
    SUB EZ_Events(FormName$, CID&, CMsg&, CVal&, Cancel&)     ' (PROTECTED)
         IF PreProcess_Events(FormName$, CID&, CMsg&, CVal&, Cancel&) THEN EXIT SUB
         SELECT CASE FormName$
              CASE "MDIPARENT"
                   EZ_MDIPARENT_ParseEvents CID&, CMsg&, CVal&, Cancel&
              CASE "MDICHILD"
                   EZ_MDICHILD_ParseEvents CID&, CMsg&, CVal&, Cancel&
              CASE "PPFORM"
                   EZ_PPFORM_ParseEvents CID&, CMsg&, CVal&, Cancel&
              CASE "TBAR1"
                   EZ_TBAR1_ParseEvents CID&, CMsg&, CVal&, Cancel&
              CASE "TBAR2"
                   EZ_TBAR2_ParseEvents CID&, CMsg&, CVal&, Cancel&
              CASE ELSE
                   OtherForm_Events FormName$, CID&, CMsg&, CVal&, Cancel&
         END SELECT
    END SUB
    '
    FUNCTION Main_Initialize(BYVAL VerNum&) AS LONG
         LOCAL RV&
         EZ_DefSystemColor 99, 8  ' define Window text color
         EZ_DefSystemColor 46, 13
         EZ_DefSystemColor 47, 14
         RV&=1
         FUNCTION=RV&
    END FUNCTION
    '
    SUB OtherForm_Design(FormName$)
         SELECT CASE FormName$
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB OtherForm_Events(FormName$, CID&, CMsg&, CVal&, Cancel&)
         SELECT CASE FormName$
              CASE "{OPENDLG}", "{SAVEDLG}", "{OPENDLGX}", "{SAVEDLGX}", "{COLORDLG}", "{FONTDLG}", "{PRINTDLG}", "{PAGEDLG}", "{FINDDLG}"
                   SELECT CASE CID&
                        CASE %EZ_Window
                             SELECT CASE CMsg&
                                  CASE %EZ_Loaded
                                       EZ_CenterForm "Main", FormName$,0
                                  CASE ELSE
                             END SELECT
                        CASE ELSE
                             SELECT CASE CMsg&
                                  CASE %EZ_OwnerDraw
                                       EZ_Draw3DButtonRR FormName$, CID&, CVal&, 34, 35,  4
                             END SELECT
                   END SELECT
              CASE "{ABORTDLG}"
              CASE "{MSGBOX}"
              CASE ELSE
         END SELECT
    END SUB
    '
    FUNCTION PreProcess_Events(FormName$, CID&, CMsg&, CVal&, Cancel&) AS LONG
         LOCAL RV&
         RV&=0
         FUNCTION=RV&
    END FUNCTION
    '
    SUB EZ_MDIPARENT_Display(BYVAL Parent$)     ' (PROTECTED)
         LOCAL hMainMenu&
         ' Main Menu handle automatically stored by EZGUI
         hMainMenu&=EZ_DefMainMenu( %MDIPARENT_MENUFILES, "&File", "")
         EZ_Color -1, -1
         EZ_Form "MDIPARENT", Parent$, "EZGUI Rich Text Editor", 0, 0, 85, 32, "^_CZ{MDI-P}"
    END SUB
    '
    SUB EZ_MDIPARENT_Design()     ' (PROTECTED)
         LOCAL CText$
         LOCAL hMainMenu&, hDropMenu&, hSubMenu&
         hMainMenu&=EZ_GetMenu("MDIPARENT", 0)
         EZ_AddMenuItem hMainMenu&, %MDIPARENT_MENUEDIT, 0, "&Edit", ""
         EZ_AddMenuItem hMainMenu&, %MDIPARENT_MENUWIN, 0, "&Windows", ""
         hDropMenu&=EZ_DefSubMenu( %MDIPARENT_MENUNEW, "&New File", "")
         EZ_SaveMenu "MDIPARENT", 1, hDropMenu&
         EZ_SetSubMenu hMainMenu& , %MDIPARENT_MENUFILES, hDropMenu&
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_MENUOPEN, 0, "&Open File", ""
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_MENUSAVE, 0, "&Save File", ""
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_MENUCLOSE, 0, "&Close File", ""
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_SEPARATOR_9025, 0, "-", ""
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_MENUPSETUP, 0, "Printer S&etup", ""
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_MENUPRINT, 0, "&Print", ""
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_MENUPPREVIEW, 0, "Print Previe&w", ""
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_SEPARATOR_9045, 0, "-", ""
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_MENUEXIT, 0, "E&xit", ""
         hDropMenu&=EZ_DefSubMenu( %MDIPARENT_MENUCOPY, "&Copy", "")
         EZ_SaveMenu "MDIPARENT", 2, hDropMenu&
         EZ_SetSubMenu hMainMenu& , %MDIPARENT_MENUEDIT, hDropMenu&
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_MENUCUT, 0, "Cu&t", ""
         EZ_AddMenuItem hDropMenu&, %MDIPARENT_MENUPASTE, 0, "&Paste", ""
         hDropMenu&=EZ_DefSubMenu( %MDIPARENT_MENUTILE, "&Tile Windows", "M")
         EZ_SaveMenu "MDIPARENT", 3, hDropMenu&
         EZ_SetSubMenu hMainMenu& , %MDIPARENT_MENUWIN, hDropMenu&
         ' ------------------------------------------------
         EZ_Color-1,-1
         EZ_UseFont 4
         EZ_SubClass 2
         EZ_Rebar %MDIPARENT_REBAR1, 0, 0, 0,  2, 0, "?^AFV["
         EZ_SubClass 0
         ' -----------------------------------------------
         EZ_Color-1,-1
         EZ_UseFont 4
         EZ_MDIClient
         ' -----------------------------------------------
         EZ_Color -1,-1
         EZ_UseFont 4
         EZ_AllowLoadingEvent 2
         EZ_StatusBar %MDIPARENT_STATUSBAR, "", ""
         EZ_ResizeMDI "MDIParent", 0, 2, 85, 28.75, 0
    END SUB
    '
    '<<SAVE>>
    DECLARE SUB PrintRTF(BYVAL PForm$, BYVAL FormName$, BYVAL ID&, BYVAL CFormName$, BYVAL CanvasID&, BYVAL PageNum&, PageCount&)
    '
    SUB ResetFocus()
         EZ_SetFocus "MDIChild", %MDICHILD_TEXT1
    END SUB
    '
    SUB UpdateFontBar()
         LOCAL TFace$, APSize!, FProp$, FColor&, I&, PT&, N&, ACN&, BFlag1&, BFlag2&, BFlag3&
         EZ_GetRichFont "MDIChild", %MDICHILD_TEXT1, TFace$, APSize!, FProp$, FColor&, 1
         IF TFace$<>App_FontName$ THEN
              App_FontName$=TFace$
              I&=EZ_FindNextLeft("TBAR2",%TBAR2_FONTNAMES,TFace$+"<", 0)
              IF I&>=0 THEN
                   EZ_SelectItem "TBAR2",%TBAR2_FONTNAMES, I&
              END IF
         END IF
         PT&=ABS(APSize!)
         IF PT&>=1 AND PT&<=127 THEN
              IF PT&<>ABS(App_FontSize!) THEN
                   App_FontSize!=PT&
                   EZ_SelectItem "TBAR2",%TBAR2_FONTSIZES, PT&-1
              END IF
         END IF
         ACN&=-1
         IF FColor&=-1 THEN
              ACN&=16
         ELSE
              FOR N&=0 TO 15
                   IF FColor&=EZ_ColorVal(N&,0) THEN
                        ACN&=N&
                        EXIT FOR
                   END IF
              NEXT N&
         END IF
         IF App_FontColor&<>FColor& THEN
              IF ACN&>=0 THEN
                   EZ_SelectItem "TBAR2", %TBAR2_FONTCOLORS, ACN&
              ELSE
                   ' erase custom color and reset it.
                   EZ_DeleteItem "TBAR2", %TBAR2_FONTCOLORS, 17
                   EZ_AddItems "TBAR2", %TBAR2_FONTCOLORS, "<&H"+HEX$(FColor&,8)+">   Custom"
                   EZ_SelectItem "TBAR2", %TBAR2_FONTCOLORS, 17
              END IF
              App_FontColor&=FColor&
         END IF
         IF INSTR(FProp$,"B") THEN BFlag1&=1 ELSE BFlag1&=0
         IF BFlag1&<>App_BoldState& THEN
              App_BoldState&=BFlag1&
              EZ_RedrawControl "TBAR2", %TBAR2_BOLDBUTTON
         END IF
         IF INSTR(FProp$,"I") THEN BFlag2&=1 ELSE BFlag2&=0
         IF BFlag2&<>App_ItalicState& THEN
              App_ItalicState&=BFlag2&
              EZ_RedrawControl "TBAR2", %TBAR2_ITALICBUTTON
         END IF
         IF INSTR(FProp$,"U") THEN BFlag3&=1 ELSE BFlag3&=0
         IF BFlag3&<>App_UnderState& THEN
              App_UnderState&=BFlag3&
              EZ_RedrawControl "TBAR2", %TBAR2_UNDERBUTTON
         END IF
         App_FontProp$=""
         IF App_BoldState& THEN App_FontProp$=App_FontProp$+"B"
         IF App_ItalicState& THEN App_FontProp$=App_FontProp$+"I"
         IF App_UnderState& THEN App_FontProp$=App_FontProp$+"U"
    END SUB
    '
    SUB UpdateAlignmentBar()
         LOCAL BFlag&, I!, LI!, RI!, AL$, TabList$, RFlag&
         EZ_GetRichPar "MDIChild", %MDICHILD_TEXT1, BFlag&, I!, LI!, RI!, AL$, TabList$
         RFlag&=0
         IF AL$="L" THEN
              IF App_LeftAlign&=0 THEN
                   App_LeftAlign&      =1
                   App_CenterAlign&    =0
                   App_RightAlign&     =0
                   RFlag&=1
              END IF
         END IF
         IF AL$="C" THEN
              IF App_CenterAlign&=0 THEN
                   App_LeftAlign&      =0
                   App_CenterAlign&    =1
                   App_RightAlign&     =0
                   RFlag&=1
              END IF
         END IF
         IF AL$="R" THEN
              IF App_RightAlign&=0 THEN
                   App_LeftAlign&      =0
                   App_CenterAlign&    =0
                   App_RightAlign&     =1
                   RFlag&=1
              END IF
         END IF
         IF RFlag& THEN
              EZ_RedrawControl "TBAR2", %TBAR2_LEFTBUTTON
              EZ_RedrawControl "TBAR2", %TBAR2_CENTERBUTTON
              EZ_RedrawControl "TBAR2", %TBAR2_RIGHTBUTTON
         END IF
    END SUB
    '
    SUB DefFirstFont()
         ResetFocus
         EZ_DoEvents 25
         EZ_SetRichSel  "MDIChild", %MDICHILD_TEXT1, 0,0
         EZ_SetRichFont "MDIChild", %MDICHILD_TEXT1, "Arial", 10.0, "", -1, "BIU-^", 0
         EZ_SetRichPar "MDIChild", %MDICHILD_TEXT1, 0,  0, 0, 0, "L", ".5|.5|.5|.5|.5|", "AT"
         ' set values so all fields forced to redraw
         App_FontName$=""
         App_FontSize!=0
         App_FontProp$=""
         App_FontColor&=0
         App_BoldState&=0
         App_ItalicState&=0
         App_UnderState&=0
         App_LeftAlign&=0
         App_CenterAlign&=0
         App_RightAlign&=0
         UpdateFontBar
         UpdateAlignmentBar
    END SUB
    '
    SUB ChangeFontEffect(BYVAL Mode&, BYVAL CVal&)
         LOCAL FontName$, FontSize!, FontProp$, FontColor&, Mask$, MyColor&, C$, P1&, P2&
         EZ_GetRichSel  "MDIChild", %MDICHILD_TEXT1, P1&, P2&
         Mask$=""
         FontName$=""
         FontSize!=-1
         FontProp$=""
         FontColor&=-2
         SELECT CASE Mode&
              CASE 1    ' Bold
                   IF App_BoldState&=0 THEN
                        FontProp$="B"
                   END IF
                   Mask$="B"
              CASE 2    ' Italic
                   IF App_ItalicState&=0 THEN
                        FontProp$="I"
                   END IF
                   Mask$="I"
              CASE 3    ' Underline
                   IF App_UnderState&=0 THEN
                        FontProp$="U"
                   END IF
                   Mask$="U"
              CASE 4    ' font name
                  FontName$=EZ_GetItemText("TBAR2",%TBAR2_FONTNAMES, CVal&)
                  FontName$=PARSE$(FontName$, "<", 1)
              CASE 5    ' font size
                   FontSize!=CVal&+1
              CASE 6    ' font color
                   SELECT CASE CVal&
                        CASE 0 TO 15
                             FontColor&=EZ_ColorVal(CVal&,0)
                        CASE 16
                             FontColor&=-1
                        CASE 17
                             C$=EZ_GetItemText("TBAR2", %TBAR2_FONTCOLORS, 17)
                             C$=PARSE$(C$,">", 1)
                             C$=TRIM$(REMOVE$(C$, "<"))
                             MyColor&=VAL(C$)
                             FontColor&=MyColor&
                             IF EZ_ChooseColor("MDIParent", MyColor&, "") THEN
                                  FontColor&=MyColor&
                             END IF
                        CASE ELSE
                             EXIT SUB
                   END SELECT
              CASE ELSE
         END SELECT
         ResetFocus
         EZ_DoEvents 25
         EZ_SetRichSel  "MDIChild", %MDICHILD_TEXT1, P1&, P2&
         EZ_SetRichFont "MDIChild", %MDICHILD_TEXT1, FontName$, FontSize!, FontProp$, FontColor&, Mask$, 1
         UpdateFontBar
    END SUB
    '
    SUB ChangeParEffect(BYVAL Mode&)
         LOCAL P1&, P2& , AL$
         EZ_GetRichSel  "MDIChild", %MDICHILD_TEXT1, P1&, P2&
         SELECT CASE Mode&
              CASE 0
                   IF App_LeftAlign&=0 THEN
                        AL$="L"
                   END IF
              CASE 1
                   IF App_CenterAlign&=0 THEN
                        AL$="C"
                   END IF
              CASE 2
                   IF App_RightAlign&=0 THEN
                        AL$="R"
                   END IF
              CASE ELSE
                   EXIT SUB
         END SELECT
         ResetFocus
         EZ_DoEvents 25
         EZ_SetRichSel  "MDIChild", %MDICHILD_TEXT1, P1&, P2&
         EZ_SetRichPar "MDIChild", %MDICHILD_TEXT1, 0,  0, 0, 0, AL$, "", "A"  ' set alignment only
         UpdateAlignmentBar
    END SUB
    '
    SUB DoFileAccess(BYVAL F$, BYVAL Mode&)
         LOCAL T$, AFN%
         AFN%=FREEFILE
         IF Mode&=1 THEN
              IF DIR$(F$)<>"" THEN KILL F$
              T$=EZ_GetRichText("MDIChild",%MDICHILD_TEXT1,1,0)
         ELSE
              IF DIR$(F$)="" THEN EXIT SUB
              T$=""
         END IF
         OPEN F$ FOR BINARY AS AFN%
         IF Mode&=1 THEN
              PUT$ AFN%, T$
         ELSE
              GET$ AFN%, LOF(AFN%), T$
              EZ_SetRichText "MDIChild",%MDICHILD_TEXT1,T$, 1,0
              UpdateFontBar
              UpdateAlignmentBar
         END IF
         CLOSE AFN%
         EZ_SetText "MDIChild",0, F$
    END SUB
    '
    SUB DoTextFile(BYVAL Mode&)
         LOCAL AF$, F$
         SELECT CASE Mode&
              CASE 0    ' New file
                   GOSUB TestForForm
                   DefFirstFont
                   EZ_SetRichText "MDIChild",%MDICHILD_TEXT1,"", 1,0
                   EZ_SetText "MDIChild", 0, "newtext.txt"
              CASE 1    ' Open
                   GOSUB TestForForm
                   EZ_ChangeDlgButtons -2
                   F$=EZ_OpenFile("MDIParent","Select Rich Text File","", "Text (*.rtf))|*.rtf|All Files (*.*)|*.*|","ZI")
                   IF F$<>"" THEN
                        DoFileAccess F$, 0
                   END IF
              CASE 2,3    ' save
                   IF EZ_Handle("MDIChild",0)<>0 THEN
                        IF EZ_IsForm("MDIChild", "Min") THEN EZ_MaximizeForm  "MDIChild"
                        AF$=EZ_GetText("MDIChild",0)
                        EZ_ChangeDlgButtons -2
                        F$=EZ_SaveFile("MDIParent","Save Rich Text File","", AF$, "Text (*.rtf))|*.rtf|All Files (*.*)|*.*|","rtf", "PNIZ")
                        IF F$<>"" THEN
                             DoFileAccess F$, 1
                        END IF
                        IF Mode&=3 THEN EZ_UnloadForm "MDIChild"
                   END IF
         END SELECT
         EXIT SUB
         TestForForm:
              IF EZ_Handle("MDIChild",0)=0 THEN
                   EZ_MDIchild_Display "MDIParent", 0,0
                   EZ_MaximizeForm "MDIChild"
              END IF
              IF EZ_IsForm("MDIChild", "Min") THEN EZ_MaximizeForm  "MDIChild"
         RETURN
    END SUB
    '
    SUB DoMenuEdit(BYVAL Mode&)
         LOCAL P1&, P2&, T$
         EZ_GetRichSel  "MDIChild", %MDICHILD_TEXT1, P1&, P2&
         SELECT CASE Mode&
              CASE 0    ' copy
                   T$ = EZ_GetRichText("MDIChild", %MDICHILD_TEXT1, 1,1 )
                   EZ_SetClipboardFormat 2
                   EZ_SetClipboard T$
              CASE 1    ' cut
                   EZ_SetRichText "MDIChild", %MDICHILD_TEXT1,"", 1,1
                   P2&=P1&
              CASE 2    ' paste
                   IF P2&>P1& THEN
                        EZ_SetRichText "MDIChild", %MDICHILD_TEXT1,"", 1,1
                        EZ_SetRichSel  "MDIChild", %MDICHILD_TEXT1, P1&, P1&
                   END IF
                   EZ_SetClipboardFormat 2
                   T$=EZ_GetClipboard
                   EZ_SetRichText "MDIChild", %MDICHILD_TEXT1,T$, 1,1
                   EZ_SetClipboardFormat 0
                   T$=EZ_GetClipboard
                   P2&=P1&+LEN(T$)
              CASE ELSE
                   EXIT SUB
         END SELECT
         ResetFocus
         EZ_DoEvents 25
         EZ_SetRichSel  "MDIChild", %MDICHILD_TEXT1, P1&, P2&
         UpdateFontBar
         UpdateAlignmentBar
    END SUB
    '
    SUB DoPrint(BYVAL Mode&)
         LOCAL PageCount&
         SELECT CASE Mode&
              CASE 0    ' printer setup
                   DIM EZP AS EZPAGE, OK&
                   EZP.UseMetric            =0
                   EZP.UseDefaultMargins    =1
                   EZP.DisableMargins       =0
                   EZP.LeftMargin           =0
                   EZP.TopMargin            =0
                   EZP.RightMargin          =0
                   EZP.BottomMargin         =0
                   EZ_ChangeDlgButtons -2
                   OK& = EZ_PageSetup("MDIParent", EZP )
              CASE 1    ' print
                   App_PageCount&=0
                   PrintRTF "MDIParent", "MDIChild", %MDICHILD_TEXT1, "", 0, 0, PageCount&
              CASE 2    ' print preview
                   App_CurrentPage&=1
                   App_PageCount&=0
                   EZ_PPForm_Display "MDIParent"
              CASE ELSE
         END SELECT
         App_CurrentPage&=0
         App_PageCount&=0
    END SUB
    '
    SUB PrintRTF(BYVAL PForm$, BYVAL FormName$, BYVAL ID&, BYVAL CFormName$, BYVAL CanvasID&, BYVAL PageNum&, PageCount&)
         LOCAL X&,Y&,W&,H&, StartChar&, LastChar&, CT&, FW!, FH!, T$, RX&, RY&
         LOCAL EZP AS EZPRINTER, RV&, Border&, PPFlag&, OKFlag&
         PageCount&=0
         IF CFormName$<>"" THEN
              IF EZ_Handle(CFormName$, CanvasID&)=0 THEN EXIT SUB
              PPFlag&=1
         ELSE
              PPFlag&=0
         END IF
         IF EZ_Handle(FormName$, ID&)=0 THEN EXIT SUB
         EZP.PrintWhat=1     ' Print All
         EZP.AllowPages=1
         EZP.AllowSelection=1
         EZP.CollateFlag=0
         IF PPFlag& THEN
              EZP.FromPage=PageNum&
              EZP.ToPage=PageNum&
         ELSE
              EZP.FromPage=1
              EZP.ToPage=999
         END IF
         EZP.MinPage=1
         EZP.MaxPage=999
         EZP.PUnits=1   ' must use anything but pixels here
         EZ_Color -1,-1
         PageCount&=0
         IF PPFlag& THEN
              EZP.PrnPaperSize=1  ' required when printing to a Canvas control !
              IF EZ_ChooseCanvas(CFormName$, CanvasID&, EZP) THEN
                   GOSUB DoPrintPages
              END IF
         ELSE
              EZ_ChangeDlgButtons -2
              IF EZ_ChoosePrinter(PForm$, EZP) THEN
                   GOSUB DoPrintPages
              END IF
         END IF
         EZ_SetForm PForm$, 1
    EXIT SUB
    '
    DoPrintPages:
       EZ_StartDoc "My Document 1"        ' Automatically displays the Abort Dialog
       RX&=(EZP.PWidth-EZP.AWidth)/2       ' difference between full page and what can be printed on
       RY&=(EZP.PHeight-EZP.AHeight)/2     ' difference between full page and what can be printed on
       Border&=EZP.DPIx/2  ' 1/2 inch border
       X&=Border&-RX&
       Y&=Border&-RY&
       W&=EZP.AWidth-(2*X&)-1      ' actual width of page - border
       H&=EZP.AHeight-(2*Y&)-1     ' actual height of page - border
       LastChar&=EZ_GetRichTextLen(FormName$, ID&, 0,0)
       LastChar&=LastChar&-1
       StartChar&=0
       EZ_SaveState
       DO
            IF StartChar&>LastChar& THEN EXIT DO
            ' simply test for printable text
            RV& = EZ_LPrintRichText(FormName$, ID&,_
                                    X&, Y&, W&, H&, _
                                    StartChar&, -1, -1)
            IF RV&<=0 THEN EXIT DO
            PageCount&=PageCount&+1
            OKFlag&=0
            SELECT CASE EZP.PrintWhat
                 CASE 1 ' print all    (uses this when printing to Canvas too)
                      OKFlag&=1
                 CASE 2 ' print pages  (only printer mode will change to this)
                      IF PageCount&>=EZP.FromPage AND PageCount&<=EZP.ToPage THEN
                           OKFlag&=1
                      ELSE
                           StartChar&=RV&
                      END IF
                 CASE ELSE
                      OKFlag&=0
            END SELECT
            IF OKFlag& THEN
                 EZ_StartPage
                 EZ_DefFont 99, "Arial", 10, "VBP"
                 ' now print the text
                 StartChar& = EZ_LPrintRichText(FormName$, ID&,_
                                                X&, Y&, W&, H&, _
                                                StartChar&, -1, 0)
                 T$="PG "+TRIM$(STR$(PageCount&))
                 EZ_GetTextSize 99, "0000000", FW!, FH!, 2
                 EZ_SetPrintFormat 0,0,0,0,0
                 EZ_Color 0,15
                 EZ_UseFont 99
                 EZ_LPrint X&+W&-FW!, Y&+H&-FH!, T$
                 EZ_FreeFont 99
                 EZ_EndPage
            END IF
            CT&=CT+1
            IF CT&>=1000 THEN EXIT DO   ' fail safe to prevent infinite loop
            IF StartChar&<=0 THEN EXIT DO
       LOOP
       EZ_RestoreState
       EZ_LPrintRichText FormName$, ID&,0,0,0,0,0,0,1
       EZ_EndDoc        ' Automatically Unloads the Abort Dialog
    RETURN
    '
    END SUB
    '
    '<<END>>
    '
    SUB MDIPARENT_MenuEvents(BYVAL MyID&, CMsg&, CVal&, Cancel&, BYVAL hMenu&, BYVAL MenuText$)
         SELECT CASE MyID&
              CASE %MDIPARENT_MENUFILES
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUNEW
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoTextFile 0
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUOPEN
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoTextFile 1
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUSAVE
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoTextFile 2
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUCLOSE
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoTextFile 3
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUPSETUP
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoPrint 0
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUPRINT
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoPrint 1
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUPPREVIEW
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoPrint 2
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUEXIT
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoTextFile 2
                             EZ_UnloadForm "MDIParent"
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUEDIT
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUCOPY
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoMenuEdit 0
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUCUT
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoMenuEdit 1
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUPASTE
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                             DoMenuEdit 2
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUWIN
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                        CASE %EZ_Selected
                   END SELECT
              CASE %MDIPARENT_MENUTILE
                   SELECT CASE CMsg&
                        CASE %EZ_Click
                        CASE %EZ_Selected
                   END SELECT
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB EZ_MDIPARENT_ParseEvents(CID&, CMsg&, CVal&, Cancel&)     ' (PROTECTED)
         SELECT CASE CID&
              CASE %EZ_Window
                   MDIPARENT_Events CID&, CMsg&, CVal&, Cancel&
              CASE %MDIPARENT_MENUFILES
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 0), "&File"
              CASE %MDIPARENT_MENUNEW
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 1), "&New File"
              CASE %MDIPARENT_MENUOPEN
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 1), "&Open File"
              CASE %MDIPARENT_MENUSAVE
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 1), "&Save File"
              CASE %MDIPARENT_MENUCLOSE
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 1), "&Close File"
              CASE %MDIPARENT_SEPARATOR_9025
              CASE %MDIPARENT_MENUPSETUP
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 1), "Printer S&etup"
              CASE %MDIPARENT_MENUPRINT
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 1), "&Print"
              CASE %MDIPARENT_MENUPPREVIEW
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 1), "Print Previe&w"
              CASE %MDIPARENT_SEPARATOR_9045
              CASE %MDIPARENT_MENUEXIT
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 1), "E&xit"
              CASE %MDIPARENT_MENUEDIT
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 0), "&Edit"
              CASE %MDIPARENT_MENUCOPY
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 2), "&Copy"
              CASE %MDIPARENT_MENUCUT
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 2), "Cu&t"
              CASE %MDIPARENT_MENUPASTE
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 2), "&Paste"
              CASE %MDIPARENT_MENUWIN
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 0), "&Windows"
              CASE %MDIPARENT_MENUTILE
                   MDIPARENT_MenuEvents CID&, CMsg&, CVal&, Cancel&, EZ_GetMenu("MDIPARENT", 3), "&Tile Windows"
              CASE  %MDIPARENT_REBAR1
                   MDIPARENT_REBAR1_Events CID&, CMsg&, CVal&, Cancel&
              CASE ELSE
                   MDIPARENT_Events CID&, CMsg&, CVal&, Cancel&
         END SELECT
    END SUB
    '
    '<<SAVE>>
    SUB ResizeRebar()
         LOCAL C!, R!, W!, H!, AC!, AR!, AW!, AH!
         EZ_GetSize "MDIParent", AW!, AH!, 0
         EZ_GetSizeC "MDIParent",%MDIPARENT_REBAR1, C!, R!, W!, H!
         EZ_ResizeC  "MDIParent",%MDIPARENT_REBAR1, C!, R!, AW!, H!
    END SUB
    '
    SUB ResizeMDIClient()
         LOCAL C!, R!, W!, H!, AC!, AR!, AW!, AH!
         EZ_GetSize "MDIParent", AW!, AH!, 0
         EZ_GetSizeC "MDIParent",%MDIPARENT_REBAR1, C!, R!, W!, H!
         AC!=0
         AR!=H!
         AH!=AH!-H!
         EZ_GetSizeC "MDIParent",%MDIPARENT_STATUSBAR, C!, R!, W!, H!
         AH!=AH!-H!
         EZ_ResizeMDI "MDIParent", AC!, AR!, AW!, AH!, 0
    END SUB
    '<<END>>
    '
    SUB MDIPARENT_Events(CID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CID&
              CASE %EZ_Window
                   SELECT CASE CMsg&
                        CASE %EZ_Loading
                        CASE %EZ_Loaded
                             EZ_SetFormIcon "MDIParent",EZ_LoadIcon("%EZEZ")
                             EZ_TBAR1_Display "MDIParent", %MDIPARENT_REBAR1, "", 0,-1, "","|E?>"
                             EZ_TBAR2_Display "MDIParent", %MDIPARENT_REBAR1, "", 0,-1, "","|E?>"
                             ResizeMDIClient
                             DIM FW!, FH!
                             EZ_GetSize "MDIParent", FW!, FH!,0
                             EZ_SetFormMinMax "MDIParent", FW!, FH!, 999,999
                        CASE %EZ_Started
                             EZ_MDIchild_Display "MDIParent", 0,0
                             EZ_MaximizeForm "MDIChild"
                        CASE %EZ_Size
                             ResizeRebar    ' resize rebar and then let Windows handle  this first
                             ' Rebar will get %EZ_Size event (subclassed) and there MDIClient will be resized
                        CASE %EZ_DoMDIMsg
                             IF EZ_IsForm(EZ_GetFocusForm, "MDI")=0 THEN Cancel&=1
                        CASE %EZ_Close
                        CASE ELSE
                   END SELECT
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MDIPARENT_REBAR1_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
              CASE %EZ_Size
                   ResizeMDIClient    ' now resize MDIclient after windows done with rebar
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB EZ_MDICHILD_Display(BYVAL Parent$, BYVAL AC!, BYVAL AR!)     ' (PROTECTED)
         EZ_Color -1, -1
         EZ_Form "MDICHILD", Parent$, "newtext.txt", AC!, AR!, 44, 17, "^_Z{MDI-C}"
    END SUB
    '
    SUB EZ_MDICHILD_Design()     ' (PROTECTED)
         LOCAL CText$
         EZ_Color-1,-1
         EZ_UseFont 4
         EZ_SubClass 2
         EZ_RichText1 %MDICHILD_TEXT1, 0, 0, 44, 17, "]BESTV"
         EZ_SubClass 0
         MDICHILD_TEXT1_Load -1,  ""
         ' -----------------------------------------------
    END SUB
    '
    SUB EZ_MDICHILD_ParseEvents(CID&, CMsg&, CVal&, Cancel&)     ' (PROTECTED)
         SELECT CASE CID&
              CASE %EZ_Window
                   MDICHILD_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %MDICHILD_TEXT1
                   MDICHILD_TEXT1_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_EditSetSel THEN
                        MDICHILD_TEXT1_EditSetSel CVal&
                   END IF
                   IF CMsg&=%EZ_SubClass THEN
                        MDICHILD_TEXT1_SubClass CVal&, Cancel&
                   END IF
              CASE ELSE
                   MDICHILD_Events CID&, CMsg&, CVal&, Cancel&
         END SELECT
    END SUB
    '
    '<<SAVE>>
    SUB ResizeTextBox(BYVAL FormName$, BYVAL ID&)
         LOCAL W!, H!
         EZ_GetSize FormName$, W!, H!, 0
         EZ_ResizeC FormName$, ID&,0,0, W!, H!
    END SUB
    '<<END>>
    '
    SUB MDICHILD_Events(CID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CID&
              CASE %EZ_Window
                   SELECT CASE CMsg&
                        CASE %EZ_Loading
                        CASE %EZ_Loaded
                        CASE %EZ_Started
                        CASE %EZ_Close
                        CASE %EZ_Size
                             ResizeTextBox "MDIChild", %MDICHILD_TEXT1
                        CASE ELSE
                   END SELECT
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MDICHILD_EditSetSel(BYVAL CVal&)
         LOCAL SMin&, SMax&
         EZ_GetSelVal CVal&, SMin&, SMax&
         ' modify SMin& and SMax& values here
         SMax&=SMin&
         EZ_SetSelVal CVal&, SMin&, SMax&
    END SUB
    '
    SUB MDICHILD_TEXT1_Load(BYVAL Mode&, BYVAL D$)
         EZ_SetRichText "MDIchild", %MDICHILD_TEXT1, D$, 0, 0
    END SUB
    '
    SUB MDICHILD_TEXT1_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Change
              CASE %EZ_Focus
                   EZ_SetDlgMsgMode 0       ' allows RichEdit to use Tab key
              CASE %EZ_NoFocus
                   EZ_SetDlgMsgMode 1       ' returns normal use of keys
              CASE %EZ_Loaded
                   DefFirstFont
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB MDICHILD_TEXT1_EditSetSel(BYVAL CVal&)
         MDIchild_EditSetSel CVal&
    END SUB
    '
    SUB MDICHILD_TEXT1_SubClass(BYVAL CVal&, Cancel&)
         LOCAL hCtrl&, Msg&, wParam&, lParam&
         EZ_GetSubClass  CVal&, hCtrl&, Msg&, wParam&, lParam&
         IF EZ_IsMsg(Msg&,"KB") THEN
              ' update the font toolbar
              UpdateFontBar
              UpdateAlignmentBar
         END IF
    END SUB
    '
    SUB EZ_PPFORM_Display(BYVAL Parent$)     ' (PROTECTED)
         EZ_Color 0, 32
         EZ_AllowLoadingEvent 2
         EZ_Form "PPFORM", Parent$, "Print Preview", 0, 0, 48.25, 29, "^CMRZ"
    END SUB
    '
    SUB EZ_PPFORM_Design()     ' (PROTECTED)
         LOCAL CText$
         EZ_Color 35, 34
         EZ_UseFont 4
         EZ_ODButton %PPFORM_NEXTPAGE, 13.5, .125, 10.75, 1.625, "Next Page", "AT"
         EZ_SetRegion "PPForm", %PPFORM_NEXTPAGE,-2,0
         ' -----------------------------------------------
         EZ_Color 35, 34
         EZ_UseFont 4
         EZ_ODButton %PPFORM_PREVPAGE, .75, .125, 10.75, 1.625, "Previous Page", "AT"
         EZ_SetRegion "PPForm", %PPFORM_PREVPAGE,-2,0
         ' -----------------------------------------------
         EZ_Color 35, 34
         EZ_UseFont 4
         EZ_ODButton %PPFORM_PRINTPAGE, 26.375, .125, 9.5, 1.625, "Print", "AT"
         EZ_SetRegion "PPForm", %PPFORM_PRINTPAGE,-2,0
         ' -----------------------------------------------
         EZ_Color 35, 34
         EZ_UseFont 4
         EZ_ODButton %PPFORM_CLOSEPREVIEW, 38, .125, 9.5, 1.625, "Close", "AT"
         EZ_SetRegion "PPForm", %PPFORM_CLOSEPREVIEW,-2,0
         ' -----------------------------------------------
         EZ_Color 0, 33
         EZ_UseFont 4
         EZ_Label %PPFORM_LABEL1, 0, 0, 48.25, 2, "[[34,32,6]]", "CO"
         ' -----------------------------------------------
         EZ_Color 0, 15
         EZ_UseFont 4
         EZ_Canvas %PPFORM_CANVAS1, 4, 2.5, 40.25, 26, "F"
         PPFORM_CANVAS1_Draw -1
         ' -----------------------------------------------
    END SUB
    '
    SUB EZ_PPFORM_ParseEvents(CID&, CMsg&, CVal&, Cancel&)     ' (PROTECTED)
         SELECT CASE CID&
              CASE %EZ_Window
                   PPFORM_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %PPFORM_NEXTPAGE
                   PPFORM_NEXTPAGE_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "PPForm", %PPFORM_NEXTPAGE, CVal&, 34, 35,  4
                   END IF
              CASE  %PPFORM_PREVPAGE
                   PPFORM_PREVPAGE_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "PPForm", %PPFORM_PREVPAGE, CVal&, 34, 35,  4
                   END IF
              CASE  %PPFORM_PRINTPAGE
                   PPFORM_PRINTPAGE_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "PPForm", %PPFORM_PRINTPAGE, CVal&, 34, 35,  4
                   END IF
              CASE  %PPFORM_CLOSEPREVIEW
                   PPFORM_CLOSEPREVIEW_Events CID&, CMsg&, CVal&, Cancel&
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_Draw3DButtonRR "PPForm", %PPFORM_CLOSEPREVIEW, CVal&, 34, 35,  4
                   END IF
              CASE  %PPFORM_LABEL1
                   IF CMsg&=%EZ_OwnerDraw THEN
                        EZ_DrawLabel CVal&, 0,  33,  "[[34,32,6]]"
                   END IF
              CASE ELSE
                   PPFORM_Events CID&, CMsg&, CVal&, Cancel&
         END SELECT
    END SUB
    '
    '<<SAVE>>
    '
    SUB InitSizePreview()
         LOCAL X!, Y!, W!, H!, TW!
         EZ_GetArea "", 0, X!, Y!, W!, H!, "DW",0,0   ' get desktop work area
         H!=H!-EZ_CY(EZ_WO("FC|3Y|3Y"))-1
         W!=W!-EZ_CX(EZ_WO("3X|3X"))-2
         TW!=(48.25/29)*H!
         IF TW!<W! THEN W!=TW!
         EZ_SetLoadVal "W", W!
         EZ_SetLoadVal "H", H!
    END SUB
    '
    SUB SetPPMinMax()
         LOCAL FW!, FH!
         EZ_GetSize "PPForm", FW!, FH!, 0
         EZ_SetFormMinMax "PPForm", FW!, FH!, 999,999
    END SUB
    '
    SUB ResizePPControls()
         LOCAL C!, R!, W!, H!, FW!, FH!
         EZ_GetSize "PPForm", FW!, FH!, 0
         EZ_GetSizeC "PPForm", %PPFORM_LABEL1, C!, R!, W!, H!
         EZ_ResizeC "PPForm", %PPFORM_LABEL1, C!, R!, FW!, H!
         EZ_GetSizeC "PPForm", %PPFORM_CANVAS1, C!, R!, W!, H!
         H!=FH!-R!-1
         W!=(8.5/11)*H!*2
         C!=(FW!-W!)/2
         EZ_ResizeC "PPForm", %PPFORM_CANVAS1, C!, R!, W!, H!
         EZ_PostEvent "PPForm",0, 1
    END SUB
    '
    SUB DisplayCurrentPage()
         PrintRTF "PPForm", "MDIChild", %MDICHILD_TEXT1, "PPForm", %PPFORM_CANVAS1, App_CurrentPage&, App_PageCount&
         IF App_CurrentPage& < App_PageCount& THEN
              EZ_EnableC "PPForm", %PPFORM_NEXTPAGE
         ELSE
              EZ_DisableC "PPForm", %PPFORM_NEXTPAGE
         END IF
    END SUB
    '<<END>>
    '
    SUB PPFORM_Events(CID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CID&
              CASE %EZ_Window
                   SELECT CASE CMsg&
                        CASE %EZ_Post
                             IF CVal&=1 THEN DisplayCurrentPage
                        CASE %EZ_Loading
                             InitSizePreview
                        CASE %EZ_Loaded
                             SetPPMinMax
                        CASE %EZ_Started
                             ResizePPControls
                        CASE %EZ_Size
                             ResizePPControls
                        CASE %EZ_Close
                        CASE ELSE
                   END SELECT
              CASE ELSE
         END SELECT
    END SUB
    '
    '<<SAVE>>
    '
    SUB DoAnotherPage(BYVAL Mode&)
         SELECT CASE Mode&
              CASE 1
                   IF App_CurrentPage& < App_PageCount& THEN
                        App_CurrentPage&=App_CurrentPage&+1
                   ELSE
                        EXIT SUB
                   END IF
              CASE -1
                   IF App_CurrentPage& > 1 THEN
                        App_CurrentPage&=App_CurrentPage&-1
                   ELSE
                        EXIT SUB
                   END IF
              CASE ELSE
                   EXIT SUB
         END SELECT
         PrintRTF "PPForm", "MDIChild", %MDICHILD_TEXT1, "PPForm", %PPFORM_CANVAS1, App_CurrentPage&, App_PageCount&
         IF App_CurrentPage& < App_PageCount& THEN
              EZ_EnableC "PPForm", %PPFORM_NEXTPAGE
         ELSE
              EZ_DisableC "PPForm", %PPFORM_NEXTPAGE
         END IF
    END SUB
    '<<END>>
    '
    SUB PPFORM_NEXTPAGE_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click, %EZ_DClick
                   DoAnotherPage 1
              CASE %EZ_OwnerDraw
              CASE %EZ_Click
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB PPFORM_PREVPAGE_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click, %EZ_DClick
                   DoAnotherPage -1
              CASE %EZ_OwnerDraw
              CASE %EZ_Click
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB PPFORM_PRINTPAGE_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   DIM PageCount&
                   PrintRTF "PPForm", "MDIChild", %MDICHILD_TEXT1, "", 0, 0, PageCount&
              CASE %EZ_OwnerDraw
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB PPFORM_CLOSEPREVIEW_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   EZ_UnloadForm "PPForm"
              CASE %EZ_OwnerDraw
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB PPFORM_CANVAS1_Draw(BYVAL Mode&)
    END SUB
    '
    SUB EZ_TBAR1_Display(BYVAL FormName$, BYVAL RebarID&, BYVAL BText$, BYVAL ImgIndex&, BYVAL HWidth&, BYVAL BGPict$, BYVAL BProp$)     ' (PROTECTED)
         EZ_Color -1, -1
         EZ_AddRBForm FormName$, RebarID&, 28, 2,"TBAR1", BText$, ImgIndex&, HWidth&, BGPict$, BProp$
    END SUB
    '
    SUB EZ_TBAR1_Design()     ' (PROTECTED)
         LOCAL CText$
         EZ_Color-1,-1
         EZ_UseFont 4
         STATIC PN1$
         IF PN1$ = "" THEN PN1$ = EZ_LoadPicture("%EZMTOOLBAR{S}")
         EZ_Toolbar %TBAR1_TOOLBAR1, PN1$,  "BBBB B|F124M", "!FNOT24X24"
         ' -----------------------------------------------
    END SUB
    '
    SUB EZ_TBAR1_ParseEvents(CID&, CMsg&, CVal&, Cancel&)     ' (PROTECTED)
         SELECT CASE CID&
              CASE %EZ_Window
                   TBAR1_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %TBAR1_TOOLBAR1
                   TBAR1_TOOLBAR1_Events CID&, CID&, 0, CMsg&, CVal&, Cancel&      ' Main Toobar ID
              CASE  %TBAR1_TOOLBAR1+1 TO  %TBAR1_TOOLBAR1+5
                   LOCAL TBNum&
                   TBNum& = CID&- %TBAR1_TOOLBAR1
                   TBAR1_TOOLBAR1_Events  %TBAR1_TOOLBAR1, CID&, TBNum&, CMsg&, CVal&, Cancel&
              CASE ELSE
                   TBAR1_Events CID&, CMsg&, CVal&, Cancel&
         END SELECT
    END SUB
    '
    SUB TBAR1_Events(CID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CID&
              CASE %EZ_Window
                   SELECT CASE CMsg&
                        CASE %EZ_Loading
                        CASE %EZ_Loaded
                        CASE %EZ_Started
                        CASE %EZ_Close
                        CASE ELSE
                   END SELECT
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB TBAR1_TOOLBAR1_Events( BYVAL TBarID&, MyID&, BYVAL ButtonN&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   SELECT CASE ButtonN&
                        CASE 1 TO 4
                             DoTextFile ButtonN&-1
                        CASE 5
                             DoPrint 1
                   END SELECT
              CASE %EZ_ToolTip
                   SELECT CASE ButtonN&
                        CASE 1
                             EZ_SetToolTip "New File"
                        CASE 2
                             EZ_SetToolTip "Open File"
                        CASE 3
                             EZ_SetToolTip "Save File"
                        CASE 4
                             EZ_SetToolTip "Close File"
                        CASE 5
                             EZ_SetToolTip "Print"
                   END SELECT
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB EZ_TBAR2_Display(BYVAL FormName$, BYVAL RebarID&, BYVAL BText$, BYVAL ImgIndex&, BYVAL HWidth&, BYVAL BGPict$, BYVAL BProp$)     ' (PROTECTED)
         EZ_Color -1, -1
         EZ_AddRBForm FormName$, RebarID&, 81, 2.5,"TBAR2", BText$, ImgIndex&, HWidth&, BGPict$, BProp$ + "K"
    END SUB
    '
    SUB EZ_TBAR2_Design()     ' (PROTECTED)
         LOCAL CText$
         EZ_Color 35, 34
         EZ_UseFont 0
         EZ_ODButton %TBAR2_BOLDBUTTON, .5, .25, 4, 2, "B", "T"
         EZ_SetRegion "TBAR2", %TBAR2_BOLDBUTTON,-2,0
         EZ_AddToolTip "TBAR2", %TBAR2_BOLDBUTTON
         ' -----------------------------------------------
         EZ_Color 35, 34
         EZ_UseFont 0
         EZ_ODButton %TBAR2_ITALICBUTTON, 4.5, .25, 4, 2, "I", "T"
         EZ_SetRegion "TBAR2", %TBAR2_ITALICBUTTON,-2,0
         EZ_AddToolTip "TBAR2", %TBAR2_ITALICBUTTON
         ' -----------------------------------------------
         EZ_Color 35, 34
         EZ_UseFont 0
         EZ_ODButton %TBAR2_UNDERBUTTON, 8.5, .25, 4, 2, "U", "T"
         EZ_SetRegion "TBAR2", %TBAR2_UNDERBUTTON,-2,0
         EZ_AddToolTip "TBAR2", %TBAR2_UNDERBUTTON
         ' -----------------------------------------------
         EZ_Color-1,-1
         EZ_UseFont 4
         EZ_AllowLoadingEvent 2
         EZ_ComboBox %TBAR2_FONTNAMES, 13.5, .625, 27.625, 15.875, "Custom Font", "$?AJOTV"
         EZ_SelectItem "TBAR2", %TBAR2_FONTNAMES, 0
         ' -----------------------------------------------
         EZ_Color-1,-1
         EZ_UseFont 4
         EZ_AllowLoadingEvent 2
         EZ_ComboBox %TBAR2_FONTSIZES, 41.75, .625, 7.625, 18.5625, "8|9|10|11|12|", "JTV"
         EZ_SelectItem "TBAR2", %TBAR2_FONTSIZES, 0
         ' -----------------------------------------------
         EZ_Color-1,-1
         EZ_UseFont 4
         EZ_AllowLoadingEvent 2
         EZ_ComboBox %TBAR2_FONTCOLORS, 50.125, .625, 17.125, 15.875, "Item 1|Item 2|Item 3|Item 4|Item 5|", "$JOTV"
         EZ_SelectItem "TBAR2", %TBAR2_FONTCOLORS, 0
         ' -----------------------------------------------
         EZ_Color 35, 34
         EZ_UseFont 0
         EZ_ODButton %TBAR2_LEFTBUTTON, 68.25, .25, 4, 2, "L", "T"
         EZ_SetRegion "TBAR2", %TBAR2_LEFTBUTTON,-2,0
         EZ_AddToolTip "TBAR2", %TBAR2_LEFTBUTTON
         ' -----------------------------------------------
         EZ_Color 35, 34
         EZ_UseFont 0
         EZ_ODButton %TBAR2_CENTERBUTTON, 72.25, .25, 4, 2, "C", "T"
         EZ_SetRegion "TBAR2", %TBAR2_CENTERBUTTON,-2,0
         EZ_AddToolTip "TBAR2", %TBAR2_CENTERBUTTON
         ' -----------------------------------------------
         EZ_Color 35, 34
         EZ_UseFont 0
         EZ_ODButton %TBAR2_RIGHTBUTTON, 76.25, .25, 4, 2, "R", "T"
         EZ_SetRegion "TBAR2", %TBAR2_RIGHTBUTTON,-2,0
         EZ_AddToolTip "TBAR2", %TBAR2_RIGHTBUTTON
         ' -----------------------------------------------
    END SUB
    '
    SUB EZ_TBAR2_ParseEvents(CID&, CMsg&, CVal&, Cancel&)     ' (PROTECTED)
         SELECT CASE CID&
              CASE %EZ_Window
                   TBAR2_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %TBAR2_BOLDBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Bold Face"
                   TBAR2_BOLDBUTTON_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %TBAR2_ITALICBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Italic"
                   TBAR2_ITALICBUTTON_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %TBAR2_UNDERBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Underlined"
                   TBAR2_UNDERBUTTON_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %TBAR2_FONTNAMES
                   TBAR2_FONTNAMES_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %TBAR2_FONTSIZES
                   TBAR2_FONTSIZES_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %TBAR2_FONTCOLORS
                   TBAR2_FONTCOLORS_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %TBAR2_LEFTBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Left Aligned"
                   TBAR2_LEFTBUTTON_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %TBAR2_CENTERBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Center"
                   TBAR2_CENTERBUTTON_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %TBAR2_RIGHTBUTTON
                   IF CMsg& = %EZ_ToolTip THEN EZ_SetToolTip "Right Aligned"
                   TBAR2_RIGHTBUTTON_Events CID&, CMsg&, CVal&, Cancel&
              CASE ELSE
                   TBAR2_Events CID&, CMsg&, CVal&, Cancel&
         END SELECT
    END SUB
    '
    SUB TBAR2_Events(CID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CID&
              CASE %EZ_Window
                   SELECT CASE CMsg&
                        CASE %EZ_Loading
                        CASE %EZ_Loaded
                        CASE %EZ_Started
                        CASE %EZ_Close
                        CASE ELSE
                   END SELECT
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB TBAR2_BOLDBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   ChangeFontEffect 1, CVal&
              CASE %EZ_OwnerDraw
                   IF App_BoldState& THEN
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 46, 47,  0
                   ELSE
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 34, 35,  0
                   END IF
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB TBAR2_ITALICBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   ChangeFontEffect 2, CVal&
              CASE %EZ_OwnerDraw
                   IF App_ItalicState& THEN
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 46, 47,  0
                   ELSE
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 34, 35,  0
                   END IF
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB TBAR2_UNDERBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                   ChangeFontEffect 3, CVal&
              CASE %EZ_OwnerDraw
                   IF App_UnderState& THEN
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 46, 47,  0
                   ELSE
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 34, 35,  0
                   END IF
              CASE ELSE
         END SELECT
    END SUB
    '
    '<<SAVE>>
    '
    SUB FillFontList()
         LOCAL F$, N&, T$
         F$=EZ_GetFont(1,"", "")+"<R>ABC   "
         N&=2
         DO
              T$=EZ_GetFont(N&,"","")
              IF T$="" THEN EXIT DO
              F$=F$+"|"+T$+"<R>ABC   "
              N&=N&+1
         LOOP
         EZ_SetLoadStr "T", F$
    END SUB
    '
    SUB FillFontSize()
         LOCAL N&, T$
         FOR N&=1 TO 127
              IF N&>1 THEN T$=T$+"|"
              T$=T$+RIGHT$("   "+STR$(N&),3)
         NEXT N&
         EZ_SetLoadStr "T", T$
    END SUB
    '
    SUB FillFontColors()
         LOCAL N&, T$, C&
         EZ_SaveState
         FOR N&=0 TO 15
              IF N&>0 THEN T$=T$+"|"
              EZ_Color N&, N&
              C&=EZ_ColorVal(N&,0)
              T$=T$+"<&H"+HEX$(C&,8)+">"
              IF N&=0 THEN T$=T$+"  Black"
              IF N&=1 THEN T$=T$+"  Dk. Blue"
              IF N&=2 THEN T$=T$+"  Dk. Green"
              IF N&=3 THEN T$=T$+"  Dk. Cyan"
              IF N&=4 THEN T$=T$+"  Dk. Red"
              IF N&=5 THEN T$=T$+"  Dk. Purple"
              IF N&=6 THEN T$=T$+"  Brown"
              IF N&=7 THEN T$=T$+"  Lt. Gray"
              IF N&=8 THEN T$=T$+"  Gray"
              IF N&=9 THEN T$=T$+"  Blue"
              IF N&=10 THEN T$=T$+"  Green"
              IF N&=11 THEN T$=T$+"  Cyan"
              IF N&=12 THEN T$=T$+"  Red"
              IF N&=13 THEN T$=T$+"  Purple"
              IF N&=14 THEN T$=T$+"  Yellow"
              IF N&=15 THEN T$=T$+"  White"
         NEXT N&
         C&=EZ_ColorVal(99,0)
         T$=T$+"|<&H"+HEX$(C&,8)+">   AutoColor"
         T$=T$+"|<&H"+HEX$(RGB(255,128,0),8)+">   Custom"
         EZ_RestoreState
         EZ_SetLoadStr "T", T$
    END SUB
    '<<END>>
    '
    SUB TBAR2_FONTNAMES_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Change
                   ChangeFontEffect 4, CVal&
              CASE %EZ_OwnerSize
                   EZ_SizeComboBox CVal&, 4
              CASE %EZ_OwnerDraw
                   EZ_DrawComboBox "TBAR2", MyID&, CVal&, 4, 0, "F"
              CASE %EZ_Loading
                   FillFontList
                   EZ_SubClass 2
              CASE %EZ_Loaded
                   EZ_SubClass 0
              CASE %EZ_EraseBG
                   Cancel&=1
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB TBAR2_FONTSIZES_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Change
                   ChangeFontEffect 5, CVal&
              CASE %EZ_Loading
                   FillFontSize
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB TBAR2_FONTCOLORS_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Change
                   ChangeFontEffect 6, CVal&
              CASE %EZ_OwnerDraw
                   EZ_DrawComboBox "TBAR2", MyID&, CVal&, 4, 0, "C"
              CASE %EZ_OwnerSize
                   EZ_SizeComboBox CVal&, 4
              CASE %EZ_Loading
                   FillFontColors
                   EZ_SubClass 2
              CASE %EZ_Loaded
                   EZ_SubClass 0
              CASE %EZ_EraseBG
                   Cancel&=1
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB TBAR2_LEFTBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                    ChangeParEffect 0
              CASE %EZ_OwnerDraw
                   IF App_LeftAlign& THEN
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 46, 47,  0
                   ELSE
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 34, 35,  0
                   END IF
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB TBAR2_CENTERBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                    ChangeParEffect 1
              CASE %EZ_OwnerDraw
                   IF App_CenterAlign& THEN
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 46, 47,  0
                   ELSE
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 34, 35,  0
                   END IF
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB TBAR2_RIGHTBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Click
                    ChangeParEffect 2
              CASE %EZ_OwnerDraw
                   IF App_RightAlign& THEN
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 46, 47,  0
                   ELSE
                        EZ_Draw3DButtonRR "TBAR2", MyID&, CVal&, 34, 35,  0
                   END IF
              CASE ELSE
         END SELECT
    END SUB
    You can download the applications source code below.
    Attached Files

    Leave a comment:


  • Chris Boss
    replied
    Power and Simplicity

    EZGUI's ease of use may fool you into thinking it lacks power, but this is not so. EZGUI's event based coding style makes coding event code very easy, yet it also allows you to use advanced features with little effort.

    Let's take an example.

    Task:
    • Create a Listbox control
    • Convert the Listbox to a Drag Listbox (Common Control feature)
    • Subclass the control and make the control sizable on the Right and Bottom borders
    • Set Minimum and Maximum sizes when user sizes control
    • Allow turning drag item feature on or off
    • when dragging is on, change controls color when mouse moves over it
    • dynamically add items to list parameter before control is actually created (Loading event)
    Here is the code that creates the control:

    Code:
         EZ_Color-1,-1
         EZ_UseFont 4
         EZ_AllowLoadingEvent 2
         EZ_SubClass 2
         EZ_ListBox %FORM1_LISTBOX1, 2.5, 3.5, 17.5, 5.25, "Apple|Orange|Grape|Watermellon|Peach|Grapefruit|Cherry|Pineapple", "^RSTV"
         EZ_SubClass 0
    Here is the Event Routine:

    Code:
    SUB FORM1_LISTBOX1_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Change
              CASE %EZ_DragItem
                   IF EZ_GetCheck("Form1", %FORM1_CHECK1)=0 THEN Cancel&=1     ' prevent dragging of items
              CASE %EZ_NoRightSize
                   Cancel&=1
              CASE %EZ_NoBottomSize
                   Cancel&=1
              CASE %EZ_MouseEnter
                   IF EZ_GetCheck("Form1", %FORM1_CHECK1)<>0 THEN EZ_SetColor "Form1", MyID&, 0,30
              CASE %EZ_MouseLeave
                   EZ_SetColor "Form1", MyID&, -1,-1
              CASE %EZ_Loading
                   EZ_SetLoadStr "T", EZ_GetLoadStr("T")+"|Pear|Cranberry|Banana"    ' add some more items at creation of control
              CASE %EZ_MinMax
                   EZ_SetMinMax CVal&, 17.5, 5.25, 30,8
              CASE ELSE
         END SELECT
    END SUB
    Notice how simple the Event routine is. All the events are in one routine and easy to understand. No window handles needed. No API calls. No complex parameters to messages to handle. If an event does need to pass complex parameters, EZGUI passes a pointer in the event routines CVal& parameter and EZGUI provides commands which takes this value as a parameter (ie. EZ_SetMinMax command). No messy structures. No API constants.

    Now this is what you get:




    Notice above are small portions of three screen shots of this simple program. The top image is the listbox, when dragging is off. The second image is the user sizing the listbox (max and min are set in code). The third image is when dragging is on and the controls color changes when the mouse moves over it (it goes back to normal when the mouse leaves the control).

    There are a number of complex API tasks involved in this simple example. Yet see how easy EZGUI makes it.

    Here is the entire program for this example: (remarks removed)

    Code:
    #COMPILE EXE
    #DIM ALL        '   This is helpful to prevent errors in coding
    #INCLUDE "C:\ezgui40pro\includes\ezgui40.inc"                          ' EZGUI Include file for Declares
    DECLARE FUNCTION Main_Initialize(BYVAL VerNum&) AS LONG
    DECLARE SUB EZ_FORM1_Display(BYVAL Parent$)
    DECLARE SUB EZ_FORM1_Design()
    DECLARE SUB EZ_FORM1_ParseEvents(CID&, CMsg&, CVal&, Cancel&)
    DECLARE SUB FORM1_Events(CID&, CMsg&, CVal&, Cancel&)
    %FORM1_LISTBOX1           = 100
    %FORM1_CHECK1             = 105
    DECLARE SUB FORM1_LISTBOX1_Events(MyID&, CMsg&, CVal&, Cancel&)
    '
    #INCLUDE "C:\ezgui40pro\includes\ezwmain.inc"                          ' EZGUI Include file for WinMain
    '
    SUB EZ_Main(VerNum&)     ' (PROTECTED)
         EZ_Reg %EZ_CUSTID,%EZ_REGNUM
         EZ_DefImageFolder "Graphics"
         EZ_AllowCommandEvents  0
         EZ_AllowMouseMoveEvents 1
         EZ_AllowCursorEvents 1
         EZ_DefFont 6, "Arial", 10, "V"
         EZ_DefFont 7, "Courier New", 10, "F"
         EZ_DefFont 8, "Times New Roman", 10, "V"
         EZ_DefFont 9, "Modern", 10, "V"
         EZ_DefSystemColor 32, 4
         EZ_DefSystemColor 33, 5
         EZ_DefSystemColor 34, 15
         EZ_DefSystemColor 35, 24
         EZ_DefColorL 36, &HB96FFF
         EZ_DefColorL 37, &H14AB9F
         EZ_DefColorL 38, &H47A7FF
         EZ_DefColorL 39, &HD2AACF
         EZ_DefColorL 40, &H1CD5E3
         EZ_DefColorL 41, &HBC8943
         EZ_DefColorL 42, &H6C6AB7
         EZ_DefColorL 43, &HDD4489
         IF Main_Initialize(VerNum&) THEN
              EZ_FORM1_Display ""
         END IF
    END SUB
    '
    SUB EZ_DesignWindow(FormName$)     ' (PROTECTED)
         SELECT CASE FormName$
              CASE "FORM1"
                   EZ_FORM1_Design
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB EZ_Events(FormName$, CID&, CMsg&, CVal&, Cancel&)     ' (PROTECTED)
         SELECT CASE FormName$
              CASE "FORM1"
                   EZ_FORM1_ParseEvents CID&, CMsg&, CVal&, Cancel&
              CASE ELSE
         END SELECT
    END SUB
    '
    FUNCTION Main_Initialize(BYVAL VerNum&) AS LONG
         LOCAL RV&
         RV&=1
         FUNCTION=RV&
    END FUNCTION
    '
    SUB EZ_FORM1_Display(BYVAL Parent$)     ' (PROTECTED)
         EZ_Color -1, -1
         EZ_Form "FORM1", Parent$, "EZGUI's simple event style coding", 0, 0, 84, 29, "C"
    END SUB
    '
    SUB EZ_FORM1_Design()     ' (PROTECTED)
         LOCAL CText$
         EZ_Color-1,-1
         EZ_UseFont 4
         EZ_AllowLoadingEvent 2
         EZ_SubClass 2
         EZ_ListBox %FORM1_LISTBOX1, 2.5, 3.5, 17.5, 5.25, "Apple|Orange|Grape|Watermellon|Peach|Grapefruit|Cherry|Pineapple", "^RSTV"
         EZ_SubClass 0
         EZ_Color-1,-1
         EZ_UseFont 4
         EZ_CheckBox %FORM1_CHECK1, 2.5, 1.75, 23, 1.5, "Allow Dragging of Listbox Items", "T"
    END SUB
    '
    SUB EZ_FORM1_ParseEvents(CID&, CMsg&, CVal&, Cancel&)     ' (PROTECTED)
         SELECT CASE CID&
              CASE %EZ_Window
                   FORM1_Events CID&, CMsg&, CVal&, Cancel&
              CASE  %FORM1_LISTBOX1
                   FORM1_LISTBOX1_Events CID&, CMsg&, CVal&, Cancel&
              CASE ELSE
                   FORM1_Events CID&, CMsg&, CVal&, Cancel&
         END SELECT
    END SUB
    '
    SUB FORM1_Events(CID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CID&
              CASE %EZ_Window
                   SELECT CASE CMsg&
                        CASE %EZ_Loading
                        CASE %EZ_Loaded
                        CASE %EZ_Started
                        CASE %EZ_Close
                        CASE ELSE
                   END SELECT
              CASE ELSE
         END SELECT
    END SUB
    '
    SUB FORM1_LISTBOX1_Events( MyID&, CMsg&, CVal&, Cancel&)
         SELECT CASE CMsg&
              CASE %EZ_Change
              CASE %EZ_DragItem
                   IF EZ_GetCheck("Form1", %FORM1_CHECK1)=0 THEN Cancel&=1     ' prevent dragging of items
              CASE %EZ_NoRightSize
                   Cancel&=1
              CASE %EZ_NoBottomSize
                   Cancel&=1
              CASE %EZ_MouseEnter
                   IF EZ_GetCheck("Form1", %FORM1_CHECK1)<>0 THEN EZ_SetColor "Form1", MyID&, 0,30
              CASE %EZ_MouseLeave
                   EZ_SetColor "Form1", MyID&, -1,-1
              CASE %EZ_Loading
                   EZ_SetLoadStr "T", EZ_GetLoadStr("T")+"|Pear|Cranberry|Banana"    ' add some more items at creation of control
              CASE %EZ_MinMax
                   EZ_SetMinMax CVal&, 17.5, 5.25, 30,8
              CASE ELSE
         END SELECT
    END SUB

    Leave a comment:


  • Chris Boss
    replied
    Just over four days left for this sale!

    There are still some free copies of the Utility Designer (100% source code) available for those who purchase EZGUI 4.0 Pro during this sale.
    Act now before they are all gone.

    Leave a comment:


  • Chris Boss
    replied
    One of the nice features in EZGUI is customization.

    While EZGUI supports third party controls (even visually in the designer) which are in DLL form (and can be created using CreateWindowEx), often one does not need a new control, but simply needs to be able to customize and existing control. VB'ers often buy third party OCX's just so they can have an existing control, but customized (ie. Listview).

    EZGUI has a number of built in engines for customizing controls or creating new ones.

    (1) EZGUI makes it easy to tap into controls internals via subclassing and message forwarding from the message loop. You can customize the effects of the mouse or keyboard.

    (2) The OwnerDraw engine makes it easy to customize the look and feel of a number of controls. No other Visual Designer/GUI Tool for PB has such an advanced ownerdraw engine builtin. Because EZGUI has its own internal graphics engine, ownerdraw is easy to work with. The simplified ownerdraw command set makes it even easy for newbies to customize the look of controls. If you need very advanced GUI's, then the more advanced and low level ownerdraw command set allows you to do most anything you need to do. No Windows API knowledge needed!

    (3) EZGUI comes with a number of its own custom controls which solve a number of problems, like the MCI control, Drag Handle control, Property Listbox control, etc.

    (4) Lastly EZGUI's Canvas control allows you to literally build all sorts of unique graphic oriented controls yourself. With its advanced graphic engine and sprite engine (does alphablending) you can create all sorts of unique controls that don't even exist in Windows.

    With EZGUI, its not enough to simply be able to use the existing controls in Windows, but one can go far beyond that and customize your own unique GUI's.

    Leave a comment:


  • Chris Boss
    replied
    One of the key features of using a runtime based system like EZGUI 4.0 Pro is the Event Engine.

    EZGUI does more than simply reroute messages to event code. It actually processes events for you and handles as much mundane stuff as possible, so you don't have to do much in the event code you write.

    The Windows API messages often require some complex code to handle an event, but with EZGUI you either don't have to anything at all or you are simply writing code to react to the event, not process it.

    Even if a specific API message doesn't require too much code to process it, when using the API directly you often find yourself having to read the API docs everytime you handle a message, just to remember what the parameters are and what API constants to use. This wastes time.

    With EZGUI the events are easy to use and easy to remember.

    For example, the %EZ_Change event.

    EZGUI passes a single event parameter (in a variable called CVal&) for events. If the event %EZ_Change occurs for the following controls, the following value is in CVal&:

    ComboBox - value is newly selected items index
    Listbox - value is newly selected items index
    Tab control - value is index of selected Tab
    Scrollbar - value is new position of scrollbar
    TrackBar - value is new position of trackbar
    UpDown control - value is new position of updown control
    Listview - value is index of column selected (header)
    Text - N/A (text has simply changed)
    Calendar - N/A (Date has simply changed)
    DateTime - N/A (Date/Time has simply changed)

    How about when you convert a Listbox control to a Drag Listbox ?

    This a feature built into the Commom Controls, but the message process required a bit complex. There is no need to process any API messages in EZGUI. When the control is created, if you select the Drag property (this is not a window style, but an EZGUI property) for the listbox control, EZGUI automatically handles the message processing and generates two new events:

    %EZ_DragItem
    %EZ_DragItemDrop

    The one parameter (CVal&) for the event passes the index of the item being dragged (%EZ_DragItem) and the new index of where it is dropped (%EZ_DragItemDrop).

    EZGUI even adds Events which themselves don't exist in the API. Two interesting events for the Listview control are:

    %EZ_LVClickInfo
    %EZ_LVDClickInfo

    When an item in a Listview control is either clicked or double clicked, EZGUI generates one of these events where you can call the EZ_GetLVClickInfo command (pass the CVal& value to it) and with it retrieve the following values about the mouse click:

    - Actual X position of mouse click in client coordinates
    - Actual Y position of mouse click in client coordinates
    - X position of mouse click relative to subitem
    - X position of mouse click relative to subitem
    - Column mouse is clicked on
    - Item Index

    How about OwnerDraw ?

    Code:
    IF CMsg&=%EZ_OwnerDraw THEN
    [SIZE=2]     EZ_Draw3DButton "Form1",%FORM1_B1,CVal&,9,15,4[/SIZE]
    [SIZE=2]END IF[/SIZE]

    Its that simple when using the simplified ownerdraw command set.
    EZGUI handles all the complex stuff for the %EZ_OwnerDraw event in the background.

    One of the most powerful parts of the event engine is the Visual Design engine. New controls can be automatically subclassed by EZGUI using its internal Visual Design (drag and drop) engine. This will automate the dragging and sizing of controls, like you would do in a Visual Designer (WYSIWYG). The controls will get the new events:

    %EZ_Drag
    %EZ_Drop
    %EZ_Dropping
    %EZ_NoDrag

    There are multiple subclassing engines in EZGUI and with most of them (doesn't matter whether it is the Visual Design engine) other events are automatically generated when the control is subclassed like:

    %EZ_LButtonDown
    %EZ_LButtonUp
    %EZ_LButtonDC
    %EZ_RButtonUp
    %EZ_MButtonUp
    %EZ_Move
    %EZ_Size
    %EZ_Sizing
    %EZ_NoTopSize
    %EZ_NoBottomSize
    %EZ_NoRightSize
    %EZ_NoLeftSize

    There are many more events not mentioned here, but you can get the point.

    The Event engine is at the core of building a Windows application. You can concentrate on what the app will do, rather than the complexities of handling mundane message processing.
    Last edited by Chris Boss; 25 Aug 2008, 08:37 PM.

    Leave a comment:


  • Chris Boss
    replied
    To learn more about what makes EZGUI 4.0 Professional different and its advantages check out the following links:

    Benefits of EZGUI 4.0 Pro:
    http://chrisboss.hypermart.net/ubb/F...ML/000088.html

    Graphics, Graphics, Graphics:
    http://www.powerbasic.com/support/pb...ad.php?t=37966

    What makes EZGUI 4.0 Pro unique:
    http://www.powerbasic.com/support/pb...ad.php?t=28721

    Leave a comment:


  • Chris Boss
    started a topic Special Sale on EZGUI 4.0 Pro ! (Save $70)

    Special Sale on EZGUI 4.0 Pro ! (Save $70)

    Special Sale on EZGUI 4.0 Professional:

    From August 25, 2008 to August 31, 2008 save $70 on EZGUI 4.0 Pro !

    Get EZGUI 4.0 Professional for only $179 (a $70 savings off the regular $249 price).

    To order quickly here is the link directly to the order page:
    http://www.cwsof.com/order.htm

    To add to the offer, the first four people who order will get a free copy of the EZGUI Utility Dialog Designer, a $29 value. I had a good customer purchased extra licenses of the Designer of which I can give some away free. The Dialog designer works similiar to the EZGUI Designer, but generates 100% source code apps (no runtimes). You can use this designer for your small apps, and EZGUI 4.0 Pro for the big ones (which need more features).
Working...
X