` Printed Icetips Article

Icetips Article



ABC: Edit in place font issues
2006-01-18 -- Arnor Baldvinsson
 
When you use Edit-in-place in ABC the font used in the entry control is inherited from the window, not the listbox. This can cause nasty visual effects if these fonts are drastically different. I have reported this problem to Softvelocity and it is reported under review. In the mean time I have tried to work around the problem.
 
In my first report, I set the font to be whatever the listbox font was by editing the EditClass.INIT method in ABEIP.CLW:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
  CODE

  SELF.ListBoxFeq = ListBox
  SELF.FieldNo    = FieldNo
  SELF.CreateControl()
  ASSERT(SELF.Feq)
  !! AB 2006-01-17 
  SELF.FEQ {Prop:FontName}   = SELF.ListBoxFeq {Prop:FontName} 
  SELF.FEQ {Prop:FontSize}   = SELF.ListBoxFeq {Prop:FontSize} 
  SELF.FEQ {Prop:Background} = SELF.ListBoxFeq {Prop:Background}
  !! AB 2006-01-17 

  SELF.UseVar &= UseVar
  SELF.Feq{PROP:Text} = SELF.ListBoxFeq{PROPLIST:Picture,SELF.FieldNo}
  SELF.Feq{PROP:Use} = UseVar
  SELF.SetAlerts
This works, but causes a problem under XP if the user has the ClearType font setting turned on and the font is a TrueType font, which do not show up correctly in Clarion entry controls. So I have improved on this by checking if ClearType is turned on. My current implementation is as follows:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
IsClearType  Byte  !! AB 2006-01-17 
  CODE

  SELF.ListBoxFeq = ListBox
  SELF.FieldNo    = FieldNo
  SELF.CreateControl()
  ASSERT(SELF.Feq)
  !! AB 2006-01-17 
  IsClearType = Choose(GetReg(REG_CURRENT_USER,|
                'Control Panel\Desktop','FontSmoothing')=2,True,False)
  If IsClearType
    SELF.FEQ {Prop:FontName}   = 'MS Sans Serif'
    SELF.FEQ {Prop:FontSize}   = 8 
  Else
    SELF.FEQ {Prop:FontName}   = SELF.ListBoxFeq {Prop:FontName} 
    SELF.FEQ {Prop:FontSize}   = SELF.ListBoxFeq {Prop:FontSize} 
  End
  SELF.FEQ {Prop:Background} = SELF.ListBoxFeq {Prop:Background}
  !! AB 2006-01-17 

  SELF.UseVar &= UseVar
  SELF.Feq{PROP:Text} = SELF.ListBoxFeq{PROPLIST:Picture,SELF.FieldNo}
  SELF.Feq{PROP:Use} = UseVar
  SELF.SetAlerts
I don't like hardcoding this so I think I will probably derive my own base class for the EIP classes and see what I can do about it. Until then, this works:)



Printed May 2, 2024, 3:47 am
This article has been viewed/printed 35124 times.
Google search has resulted in 16 hits on this article since January 25, 2004.