Highlighted
Absent Member.
Absent Member.
760 views

[archive] Attempting to modify a font in an ActiveX

[Migrated content. Thread originally posted on 15 February 2010]

We are using a CheckListBox ActiveX Control which seems to work pretty well.
The problem is, we want the font to match the other controls on the screen.
In the VB examples that came with the control they call the windows font dialog box then move the font object to the control. I tried to simulate this using a call to W$FONT with no effect.

The .def looks like this:

*[Class: @_DCheckListBox] Font
* Returns a Font object.
PROPERTY-GET, -512, @Font
RETURNING "Font*", TYPE 9
*[Class: @_DCheckListBox] Font
* Returns a Font object.
PROPERTY-PUT, -512, @Font,
"Font* (Property_Value)", TYPE 9

I have tried this:

77 list-font handle of font.

display CheckListBox
handle in ChkList-handle
line 2 col 5 lines 3 size 22
visible 1
EVENT PROCEDURE IS ChkList-EVENT.

inquire ChkList-handle @Font() in list-font.

* initialize wfont-data.
call "w$font" using WFONT-CHOOSE-FONT, list-font,
wfont-data giving wfont-status.

MODIFY ChkList-handle @Font(list-font).

This is how they do it in VB.net:

' Change the font property of the CheckListBox control
Private Sub btnFont_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles btnFont.Click
FontDialog1.Color = ChkList1.ForeColor
FontDialog1.Font = ChkList1.Font
FontDialog1.ShowDialog()
If FontDialog1.Font.Name <> "" Then
ChkList1.Font = FontDialog1.Font
ChkList1.ForeColor = FontDialog1.Color
End If
End Sub

We do not use Acubench.
Any ideas would be greatly appreciated.

Thanks,
Steve
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Attempting to modify a font in an ActiveX

Steve,

You have to use the activex font definition found in acuclass.def. Below is an example I used for an activex grid control. We had the font definition stored in a file and just recalled it for the grid (using W$font).

Rob



01 GRID-FONT-HANDLE       HANDLE OF IFONTDISP.

...

Initialize Wfont-data
Call "w$font" Using Wfont-describe-font, Grid-font, Wfont-data
   Giving ws-status.
If Ws-status = 1
  Inquire grid-handle @font In Grid-font-handle
  Modify Grid-font-handle
           @name = Wfont-name
           @size = Wfont-size
           @bold = Wfont-bold-state
           @underline = Wfont-underline-state
           @italic = Wfont-italic-state
           @strikethrough = Wfont-strikeout-state
           @charset = Wfont-char-set
  Destroy grid-font-handle
End-if.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Attempting to modify a font in an ActiveX

Rob,

Thanks so much! That worked like a charm.

Thanks,
Steve
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.