FWH 17.04: BtnBmp: Symbol Fonts as bitmaps

Post Reply
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

FWH 17.04: BtnBmp: Symbol Fonts as bitmaps

Post by nageswaragunupudi »

We know the fonts "Segoe MDL2 Assets" on Windows 10, "Segoe UI Symbol" on Windows 8 onwards and "WingDings" on all versions of Windows provide images. Using these fonts in the place of bitmaps on Buttons involves additional programming.

You may build and run fwh\samples\uisymbols.prg to view all the images displayed for different characters by Segoe MDL2 Assets, Segoe UI Symbol, WingDings, WingDings 2 and WingDings3. We can use this to pick up the character we need to display the image we want.

To use a character as bitmap, simply mention the ASC value of the character as the FILE or RESOURCE while defining BtnBmp or ButtonBmp.

Example for Segoe fonts:

Code: Select all

DEFINE BUTTON OF oBar PROMPT "text" RESOURCE 0xE112 ACTION MyAction()
@ 100,100 BTNBMP RESOURCE 0xE112,0xE113 ACTION MyAction()
 
On Windows 10, the character will be displayed using Segoe MDL2 Assets font. On others, Segoe UI Symbol font is used, if available. If this font also is not available nothing is displayed.

WingDing fonts:
While specifying the ASC value, please add 0x10000, 0x20000 or 0x30000 to the asc value for WingDings, WingDings 2, WingDings 3 fonts respectively. This added value indicates to the library which font is to be used.

WingDing fonts work on all OS from Windows XP onwards.

Sample using Segoe Fonts:

Code: Select all

#include "fivewin.ch"

function Main()

   local oWnd, oBar

   DEFINE WINDOW oWnd TITLE "USING SEGOE SYMBOLS AS BITMAPS"
   DEFINE BUTTONBAR oBar OF oWnd SIZE 56,64 2013

   DEFINE BUTTON OF oBar PROMPT "Back"    RESOURCE 0xE112
   DEFINE BUTTON OF oBar PROMPT "Top"     RESOURCE 0xE100 GROUP
   DEFINE BUTTON OF oBar PROMPT "Bottom"  RESOURCE 0xE101
   DEFINE BUTTON OF oBar PROMPT "Add"     RESOURCE 0xE109 GROUP
   DEFINE BUTTON OF oBar PROMPT "Edit"    RESOURCE 0xE104
   DEFINE BUTTON OF oBar PROMPT "Delete"  RESOURCE 0xE107
   DEFINE BUTTON OF oBar PROMPT "Save"    RESOURCE 0xE105 GROUP
   DEFINE BUTTON OF oBar PROMPT "Refresh" RESOURCE 0xE149
   DEFINE BUTTON OF oBar PROMPT "Find"    RESOURCE 0xE11A
   DEFINE BUTTON OF oBar PROMPT "Setup"   RESOURCE 0xE115

   // This is optional, to change colors when mouse is over.
   AEval( oBar:aControls, { |oBtn| oBtn:bColorMap := { |o| If( o:lMOver, { CLR_BLACK, CLR_HRED }, nil ) } } )

   // Changing images
   @ 100,200 BTNBMP RESOURCE 0xE112,0xE111,nil,0xE110 SIZE 96,96 PIXEL OF oWnd 2007

   ACTIVATE WINDOW oWnd CENTERED

return nil
 
Image

Sample using WingDing fonts:

Code: Select all

#include "fivewin.ch"

function Main()

   local oWnd, oBar

   DEFINE WINDOW oWnd TITLE "USING WINGDINGS AS BITMAPS"

   DEFINE BUTTONBAR oBar OF oWnd SIZE 56,64 2013

   DEFINE BUTTON OF oBar PROMPT "Back"    RESOURCE 0x100DF
   DEFINE BUTTON OF oBar PROMPT "Top"     RESOURCE 0x100E9 GROUP
   DEFINE BUTTON OF oBar PROMPT "Bottom"  RESOURCE 0x100EA
   DEFINE BUTTON OF oBar PROMPT "Add"     RESOURCE 0x2002F GROUP
   DEFINE BUTTON OF oBar PROMPT "Edit"    RESOURCE 0x20022
   DEFINE BUTTON OF oBar PROMPT "Delete"  RESOURCE 0x20033
   DEFINE BUTTON OF oBar PROMPT "Save"    RESOURCE 0x1003C GROUP
   DEFINE BUTTON OF oBar PROMPT "Refresh" RESOURCE 0x30050
   DEFINE BUTTON OF oBar PROMPT "Setup"   RESOURCE 0x1005D

   // Optional
   AEval( oBar:aControls, { |oBtn| oBtn:bColorMap := { |o| If( o:lMOver, { CLR_BLACK, CLR_HRED }, nil ) } } )

   // Changing faces
   @ 100,200 BTNBMP RESOURCE 74,76,nil,75 SIZE 96,96 PIXEL OF oWnd 2007

   ACTIVATE WINDOW oWnd CENTERED

return nil
 
Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
augustogomes
Posts: 23
Joined: Mon Jun 06, 2016 8:38 pm
Location: Ribeirão Preto - SP - Brasil

Re: FWH 17.04: BtnBmp: Symbol Fonts as bitmaps

Post by augustogomes »

Thanks for the info
I liked knowing that.
Augusto Gomes /Suprisystem Informática - Fivewin 16.08 - xharbour 123 - BCC70 - DBFNTX e PostGreSql
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 17.04: BtnBmp: Symbol Fonts as bitmaps

Post by nageswaragunupudi »

augustogomes wrote:Thanks for the info
I liked knowing that.
What is the info you wanted?
Regards

G. N. Rao.
Hyderabad, India
User avatar
augustogomes
Posts: 23
Joined: Mon Jun 06, 2016 8:38 pm
Location: Ribeirão Preto - SP - Brasil

Re: FWH 17.04: BtnBmp: Symbol Fonts as bitmaps

Post by augustogomes »

Resolvido.

Obrigado.
Augusto Gomes /Suprisystem Informática - Fivewin 16.08 - xharbour 123 - BCC70 - DBFNTX e PostGreSql
Post Reply