Page 1 of 1

BTNBMP FONT

Posted: Thu Feb 11, 2021 3:56 pm
by Ladinilson
Hello everyone,

I am using BTNBMP to show a set of buttons but I have already modified the FONT several times and it does not change.

I can even set the font but I can't increase the size

Do any of you know any solutions?

Code: Select all

REDEFINE BTNBMP ButQST[nContST] ID nIDST OF oStObj FONT oFont13 PROMPT ALLTRIM(STR(nContST,2)) PIXELS ;
FILE "H:\LSOFT\BINGO\FIGURAS\BOLAQD.PNG" ADJUST CENTER NOBORDER TRANSPARENT

ButQST[nContST]:SETCOLOR( NRGB(180,180,180) )  
Thank you!

Re: BTNBMP FONT

Posted: Thu Feb 11, 2021 7:52 pm
by nageswaragunupudi
You can change font, size everything.
Let us know how you tried and what is not working for you.

Re: BTNBMP FONT

Posted: Thu Feb 11, 2021 8:22 pm
by Ladinilson
I change the size of the FONT but it remains with a defined size ...

Code: Select all

DEFINE FONT oFont2000 NAME "ARIAL ROUNDED MT BOLD" SIZE 0,-14 BOLD

DEFINE FONT oFont2000 NAME "ARIAL ROUNDED MT BOLD" SIZE 0,-18 BOLD

DEFINE FONT oFont2000 NAME "ARIAL ROUNDED MT BOLD" SIZE 0,-32 BOLD

DEFINE FONT oFont2000 NAME "ARIAL ROUNDED MT BOLD" SIZE 0,-46 BOLD
 
I changed for all these sizes but it hasn't changed

Re: BTNBMP FONT

Posted: Thu Feb 11, 2021 8:41 pm
by nageswaragunupudi
If you want to change the font of BtnBmp (or any control, window, dialog)

DEFINE oNewFont NAME ....................
and then
oBtn:SetFont( oNewFont )
RELEASE FONT oNewFont

Re: BTNBMP FONT

Posted: Thu Feb 11, 2021 8:57 pm
by Ladinilson
Yes i already tried this...

Code: Select all

ButQST[nContST]:SETFONT(oFont2000)
just like this ...

Code: Select all

ButQST[nContST]:oFontBold := oFont2000
and I didn't get any results
I think you are at REDEFINE this problem because using @ it seems that it works

Re: BTNBMP FONT

Posted: Fri Feb 12, 2021 4:23 am
by nageswaragunupudi
I think you are at REDEFINE this problem because using @ it seems that it works
No. It is because you are not doing it correctly.

Please try this program:

Code: Select all

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg, aBtn[ 3 ]
   local oFont1, oFont2

   DEFINE FONT oFont1 NAME "TAHOMA" SIZE 0,-12
   DEFINE DIALOG oDlg RESOURCE "Main" FONT oFont1

   REDEFINE BTNBMP aBtn[ 1 ] PROMPT "Change" + CRLF + "Font" ID 110 OF oDlg CENTER
   aBtn[ 1 ]:bAction := <||
      DEFINE FONT oFont2 NAME "VERDANA" SIZE 0,-16 BOLD
      AEval( aBtn, { |oBtn| oBtn:SetFont( oFont2 ), oBtn:Refresh() } )
      RELEASE FONT oFont2
      return nil
      >

   REDEFINE BTNBMP aBtn[ 2 ] PROMPT "Multi" + CRLF + "Line"    ID 120 OF oDlg CENTER ;
      ACTION AEval( aBtn, { |oBtn| oBtn:oFontBold := oFont1, oBtn:Refresh() } )

   REDEFINE BTNBMP aBtn[ 3 ] PROMPT "Old" + CRLF + "Font"  ID 130 OF oDlg CENTER ;
      ACTION AEval( aBtn, { |oBtn| oBtn:oFontBold := nil, oBtn:SetFont( oFont1 ), oBtn:Refresh() } )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont1

return nil
 
rc file:

Code: Select all

#include "..\include\WinApi.ch"

main DIALOG 50, 67, 162, 76
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "FiveWin Class TBtnBmp"
FONT 12, "MS Sans Serif"
{
 CONTROL "", 110, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 9, 41, 43, 21
 CONTROL "", 120, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 60, 41, 43, 21
 CONTROL "", 130, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 110, 41, 43, 21
}
Image

Re: BTNBMP FONT

Posted: Fri Feb 12, 2021 6:01 am
by Ladinilson
Thanks G. N. Rao.!