| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > EditFontClass >====== EditFontClass Conceptual Example {{c6h0009.jpg|C6H0009.jpg}} ====== | [[editfontclass source files.htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[editfontclass properties.htm|{{btn_next_n.gif|Next page}}]] | | || The following example shows a sequence of statements to declare, instantiate, initialize, use, and terminate an EditFontClass object and a related BrowseClass object. The example page-loads a LIST of fieldnames and associated control attributes (such as color, font, icon, etc.), then edits the "Font" items with an EditFontClass object. Note that the BrowseClass object calls the "registered" EditFontClass object's methods as needed. **   PROGRAM** **_ABCDllMode_  EQUATE(0)** **_ABCLinkMode_ EQUATE(1)** **   INCLUDE('ABWINDOW.INC')             !declare WindowManager** **   INCLUDE('ABBROWSE.INC')             !declare BrowseClass** **   INCLUDE('ABEIP.INC')                !declare EditInPlace classes** **   MAP** **   END** **Property   FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD** **NameKey    KEY(PR:FieldName),NOCASE,OPT** **Record      RECORD,PRE()** **FieldName    STRING(30)** **Color        STRING(20)** **Hidden       STRING(1)** **IconFile     STRING(30)** **Font         STRING(40)** **ControlType  STRING(12)** **ApplyTo      CSTRING(500)** **            END** **           END** **     ** **PropView VIEW(Property)** **         END** **PropQ         QUEUE** **PR:FieldName   LIKE(PR:FieldName)** **PR:Color       LIKE(PR:Color)** **PR:Font        LIKE(PR:Font)** **PR:ControlType LIKE(PR:ControlType)** **PR:Hidden      LIKE(PR:Hidden)** **PR:IconFile    LIKE(PR:IconFile)** **PR:ApplyTo     LIKE(PR:ApplyTo) ** **ViewPosition   STRING(1024)** **              END** **BRW1  CLASS(BrowseClass) !declare BRW1--a BrowseClass object** **Q      &PropQ            ! that drives the EditClass objects** **      END** **Edit:PR:Font CLASS(EditFontClass)   !declare Edit:PR:Font-EIP font dialog** **Init      PROCEDURE(UNSIGNED FieldNumber,UNSIGNED ListBox,*? UseVar),VIRTUAL** **TakeEvent PROCEDURE(UNSIGNED Event),BYTE,VIRTUAL** **TypeFace  CSTRING(30)   !declare font typeface property** **FontSize  LONG          !declare font size property** **FontStyle LONG          !declare font style property** **FontColor LONG          !declare font color property** **             END** **PropWindow WINDOW('Browse Properties'),AT(,,318,137),IMM,SYSTEM,GRAY** **       LIST,AT(8,4,303,113),USE(?PropList),IMM,HVSCROLL,FROM(PropQ),|** **       FORMAT( '50L(2)|_M~Field Name~@s30@[70L(2)|_M~Color~@s20@' &|** **           '60L(2)|_M~Font~@s40@60L(2)|_M~Control Type~@s12@' &|** **           '20L(2)|_M~Hide~L(0)@s1@/130L(2)|_M~Icon File~@s30@' &|** **           '120L(2)|_M~Apply To~L(0)@s25@]|M')** **       BUTTON('&Insert'),AT(169,121),USE(?Insert)** **       BUTTON('&Change'),AT(218,121),USE(?Change),DEFAULT** **       BUTTON('&Delete'),AT(267,121),USE(?Delete)** **      END** **GlobalErrors  ErrorClass** **Access:Property CLASS(FileManager)** **Init             PROCEDURE** **                END** **Relate:Property CLASS(RelationManager)** **Init             PROCEDURE** **Kill             PROCEDURE,VIRTUAL** **                END** **GlobalRequest   BYTE(0),THREAD** **GlobalResponse  BYTE(0),THREAD** **VCRRequest      LONG(0),THREAD** **ThisWindow CLASS(WindowManager)** **Init        PROCEDURE(),BYTE,PROC,VIRTUAL** **Kill        PROCEDURE(),BYTE,PROC,VIRTUAL** **           END** ** CODE** ** GlobalErrors.Init** ** Relate:Property.Init** ** GlobalResponse = ThisWindow.Run()** ** Relate:Property.Kill** ** GlobalErrors.Kill** **ThisWindow.Init  PROCEDURE()** **ReturnValue    BYTE,AUTO** ** CODE** ** SELF.Request = GlobalRequest** ** ReturnValue = PARENT.Init()** ** SELF.FirstField = ?PropList** ** SELF.VCRRequest &= VCRRequest** ** SELF.Errors &= GlobalErrors** ** Relate:Property.Open** ** BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)** ** OPEN(PropWindow)** ** SELF.Opened=True** ** ?PropList{PROP:LineHeight}=12          !enlarge rows to accomodate EIP icons** **  BRW1.Q &= PropQ** **  BRW1.AddSortOrder(,PR:NameKey)** **  BRW1.AddField(PR:FieldName,BRW1.Q.PR:FieldName)** **  BRW1.AddField(PR:Color,BRW1.Q.PR:Color)** **  BRW1.AddField(PR:Font,BRW1.Q.PR:Font)** **  BRW1.AddField(PR:ControlType,BRW1.Q.PR:ControlType)** **  BRW1.AddField(PR:Hidden,BRW1.Q.PR:Hidden)** **  BRW1.AddField(PR:IconFile,BRW1.Q.PR:IconFile)** **  BRW1.AddField(PR:ApplyTo,BRW1.Q.PR:ApplyTo)** **  BRW1.AddEditControl(Edit:PR:Font,3)     !Use Edit:PR:Font to edit BRW1 col 3** **  BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn** **  BRW1.InsertControl=?Insert** **  BRW1.ChangeControl=?Change** **  BRW1.DeleteControl=?Delete** **  SELF.SetAlerts()** **  RETURN ReturnValue** **ThisWindow.Kill  PROCEDURE()** **ReturnValue    BYTE,AUTO** **  CODE** **  ReturnValue = PARENT.Kill()** **  Relate:Property.Close** **  RETURN ReturnValue** **Edit:PR:Font.Init  PROCEDURE(UNSIGNED FieldNumber,UNSIGNED ListBox,*? UseVar)** **Comma      BYTE(1)** **SaveFont   CSTRING(100)         !indexable hold area for font spec** **i          USHORT** ** CODE** ** PARENT.Init(FieldNumber,ListBox,UseVar)** ** SaveFont=SELF.UseVar          !comma separated font attributes** ** IF SaveFont                   ! e.g. Arial,14,255,400** **    LOOP WHILE Comma           !parse/separate the font attributes** **     Comma = INSTRING(',',SaveFont,1,1)** **     i+=1** **     IF Comma** **      EXECUTE i** **       SELF.TypeFace  = SaveFont[1 : Comma-1]  !get Typeface** **       SELF.FontSize  = SaveFont[1 : Comma-1]  !get FontSize** **       BEGIN** **        SELF.FontColor = SaveFont[1 : Comma-1] !get FontColor & Style** **        SELF.FontStyle = SaveFont[Comma+1 : LEN(SaveFont)]** **       END** **      END** **     SaveFont=SaveFont[Comma+1 : LEN(SaveFont)]** **     END** **    END** **  END** **Edit:PR:Font.TakeEvent PROCEDURE(UNSIGNED Event)** **ReturnValue       BYTE,AUTO** **  CODE** **  CASE Event** **  OF EVENT:DroppingDown              !call Font dialog & store result** **                                     ! in comma separated string** ** ****IF FONTDIALOG(SELF.Title,SELF.TypeFace,SELF.FontSize,SELF.FontColor,SELF.FontStyle)** ** ****SELF.UseVar = SELF.TypeFace&','&SELF.FontSize&','&SELF.FontColor&','&SELF.FontStyle** ** DISPLAY(SELF.Feq)** **  END** **  RETURN EditAction:Ignore            !no I/O action on DroppingDown** **  ELSE                       !otherwise, default I/O action:** **   RETURN PARENT.TakeEvent(Event)         ! save, cancel, next field, etc.** **  END** **Access:Property.Init PROCEDURE** ** CODE** ** PARENT.Init(Property,GlobalErrors)** ** SELF.FileNameValue = 'Property'** ** SELF.Buffer &= PR:Record** ** SELF.Create = 1** ** SELF.AddKey(PR:NameKey,'PR:NameKey',0)** **Relate:Property.Init PROCEDURE** ** CODE** ** Access:Property.Init** ** PARENT.Init(Access:Property,1)** **Relate:Property.Kill PROCEDURE** ** CODE** ** Access:Property.Kill** ** PARENT.Kill**