Jump to content

How to set listview font in TVExplorer UDF?


qwert
 Share

Recommended Posts

I've used the TVExplorer UDF for a while.  But now I have a need to use a fixed-pitch font for one of my views.

Looking at other examples, I thought I could use the view's handle in a SetFont statement.  That idea works for the associated "input" control, but not for the view, itself:

$Input[2] = GUICtrlCreateInput('', 20, 378, 660, 19)
GUICtrlSetFont($Input[2], 12, Default, Default, "Courier New")
GUICtrlSetState(-1, $GUI_DISABLE)

$hTV[2] = _GUICtrlTVExplorer_Create(@ProgramFilesDir, 20, 406, 660, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent')
GUISetFont(12, Default, Default, "Courier New", $hTV[2])

Would anyone have a suggestion?  I'm very unsure at what level to attempt a setting.  In the calling script?  In the TVExplorer.au3?  In GUITreeView.au3?

Thanks in advance for any help.

 

TVE_Font.thumb.PNG.6be03a1607427977440a0

Link to comment
Share on other sites

Link to comment
Share on other sites

Indeed, that works ... but only if I insert the statement in the create function of the UDF, itself.  Multiple tries / variations from the control script did not work.

$ID = GUICtrlCreateTreeView($iX, $iY, $iWidth, $iHeight, $iStyle, $iExStyle)    ;<<<<<<<<<<
    GUICtrlSetFont($ID, 12, Default, Default, "Courier New")

Although I was hoping for a way that didn't require modifying the UDF, this solves my immediate problem.

Thanks very much for your response.

 

TVE_Fixed.thumb.PNG.7278cb5d7de6d53cc5c3

Link to comment
Share on other sites

Use
GUICtrlSetFont(-1, 12, Default, Default, "Courier New")

after you create you treeview _GUICtrlTVExplorer_Create

or get the control ID returned from _GUICtrlTVExplorer_Create  $hTV[0]=_GUICtrlTVExplorer_Create

$ID=_WinAPI_GetDlgCtrlID($hTV[0])

GUICtrlSetFont($ID, 12, Default, Default, "Courier New")

Saludos

Link to comment
Share on other sites

$ID = _WinAPI_GetDlgCtrlID($hTV[0])  did the trick ... and I put the UDF back to standard.

I had been using the control handle in my attempts, when the control ID was needed.  Details!

Thanks for following up on this.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...