No announcement yet.

My Little Grid - How to change font

  • Filter
  • Time
  • Show
Clear All
new posts

    My Little Grid - How to change font

    Hello James,

    Thank you the new version 1.10; I'm happy to be able to use MLG with FireFly.

    I understand that I can change the font for the grid using the %MLG_SETGRIDEXSTYLE message; I would like to use Tahoma font for the cells and the headers.
    	Local gi As GridInit
    	GI.hFont       = ???        ' Cell Font
    	GI.hFontBold   = ???        ' Header Font for column and row headers
    	GI.hFontItalic = ???        ' Italic for option format override NEW TO VERSION 1.08	
       	SendMessage HWND_FORM1_MLG1, %MLG_SETGRIDEXSTYLE, VarPtr(GI), 0
    Can you tell me which value I've to use (instead of ???) for the Tahoma font.
    Thank you for your support.
    Jean-Pierre LEROY

    Hi Jean-Pierre,

    My first thought would be that you would create the font yourself and then pass that handle to the GridInit structure. You can create the font via the FF_MakeFontEX FireFly function. I think you will need to handle the lifespan of that font handle rather than allowing the grid to delete. Therefore, you should create the font in your WM_CREATE message handler and destroy it (using DeleteObject(hFont)) in your WM_DESTROY message handler. Jim can correct me if I'm wrong.
    Paul Squires
    FireFly Visual Designer (for PowerBASIC Windows 10+)
    Version 3 now available.


      Thank you Paul for your answer; it works.

      Don't you think it could be easier to add additional proporties for the MLG control :
      • Cell Font
      • Header Font
      • ...

      So everything could be managed by FireFly instead of me.

      What do you think ? is-it possible ?

      Jean-Pierre LEROY


        Thanks for the reply Paul. MLG will destroy the existing fonts when user defined fonts are assigned to MLG so the user never has to worry. Also when the Grid is destroyed, the current user defined fonts are destroyed along with the grid. Maybe down the road I will add some properties messages (such as the fonts etc) but currently MLG is not wired that way. I have worked a lot on MLG lately and would like people to drive it a while. As I have said before, MLG was designed for manipulating database tables and not so much for form entry which demands more formatting options.