FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Newbie question about FWH 9.03
Posts: 41
Joined: Thu Dec 22, 2005 07:39 AM
Newbie question about FWH 9.03
Posted: Fri Apr 03, 2009 06:19 AM

Good day!
I'm a novice in FWH 9.03, but... it seems that in fivewin.ch in commands "DEFINE BUTTON" and "REDEFINE BUTTON" strings:

[ <resource: NAME, RESNAME, RESOURCE> <cResName1> ;
[,<cResName2>[,<cResName3>][,<cResName4>] ] ] ;

is not properly correct. Only with this patching:

[ <resource: NAME, RESNAME, RESOURCE> <cResName1> ;
[,<cResName2>[,<cResName3>[,<cResName4>] ] ] ];

i can use four bitmap resources to make btnbmp.
I'm sorry, if I wrote rubbish... I'm just learning... :oops:
Thanks.

Best regards!

Sergey (Loach) Abelev

fwh 9.04/xHarbour 1.2.1 (Rev. 6406)/Bcc55
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Newbie question about FWH 9.03
Posted: Fri Apr 03, 2009 08:33 AM

Sergey,

Welcome to the forums :-)

Yes, your solution is fine. We were reported about that problem some days ago,

Thanks! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 41
Joined: Thu Dec 22, 2005 07:39 AM
Re: Newbie question about FWH 9.03
Posted: Fri Apr 03, 2009 12:11 PM

Thank you so much, Mr. Antonio !
And another questions:
- I can't use resource bitmaps with class TButtonBmp. Am I right?
- When I don't use the clause "2007" in BTNBMP, the bitmap paints always in the center of the button (not depend from layout: LEFT, RIGHT... ). If i use clause "2007", - it's all right. Is it my mistake?
- Can I change the font of the buttons captions (prompts) on buttonbar? It seems that string in method paint() of class btnbmp: "hOldFont = SelectObject( ::hDC, If( ::lBarBtn, ::oWnd:oFont:hFont, ::oFont:hFont ) )" means that font always take from parent window... Why it doing that way?
Thank's for help!

Best regards!

Sergey (Loach) Abelev

fwh 9.04/xHarbour 1.2.1 (Rev. 6406)/Bcc55
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Newbie question about FWH 9.03
Posted: Fri Apr 03, 2009 01:25 PM
Sergey,

You can use bitmaps from resources for Class TButtonBmp objects too.

If there is a file with the bitmap name, then it is loaded from disk. If not, then it is loaded from resources:
Code (fw): Select all Collapse
METHOD LoadBitmap( cBmpName ) CLASS TButtonBmp

   if ! Empty( ::hBitmap )
      DeleteObject( ::hBitmap )
      ::hBitmap = nil
   endif
   
   ::cBitmap = cBmpName
   
   if File( cBmpName )
      ::hBitmap = ReadBitmap( 0, cBmpName )
   else
      ::hBitmap = LoadBitmap( GetResources(), cBmpName )
   endif
   
return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Newbie question about FWH 9.03
Posted: Fri Apr 03, 2009 01:30 PM

Sergey,

>
When I don't use the clause "2007" in BTNBMP, the bitmap paints always in the center of the button (not depend from layout: LEFT, RIGHT... ). If i use clause "2007", - it's all right. Is it my mistake?
>

It may be a bug on our side. We are going to check it, thanks :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Newbie question about FWH 9.03
Posted: Fri Apr 03, 2009 01:34 PM

Sergey,

> Can I change the font of the buttons captions (prompts) on buttonbar?

Do you mean to change the font of a single button of the buttonbar ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Newbie question about FWH 9.03
Posted: Fri Apr 03, 2009 08:42 PM
Hello,

I think, changing the font in Buttonbar, is still the old problem.
There is a font define in class BtnBmp, has to be changed, if a different font is desired.
Maybe it is possble, the user can define the font ?

viewtopic.php?f=3&t=12069&p=59981&hilit=buttonbar+font#p59981

Code (fw): Select all Collapse
      if ::lBarBtn
         if ::oWnd:oFont != nil
            if ::oWnd:oFont:cFaceName != "Tahoma"
               DEFINE FONT oFont NAME "Tahoma" SIZE 0, -11
               ::oWnd:SetFont( oFont )
            endif
         else
            DEFINE FONT oFont NAME "Tahoma" SIZE 0, -11
            ::oWnd:SetFont( oFont )
         endif
      else


Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 41
Joined: Thu Dec 22, 2005 07:39 AM
Re: Newbie question about FWH 9.03
Posted: Sat Apr 04, 2009 08:08 AM

Thanks for your kindness!
Antonio, Ugo is right. I just want to define font of the buttons on buttonbar. It's not so important, one button, or every buttons. If font will be change on all buttons, it will be OK!
I tried to replace this string in btnbmp.prg:

hOldFont = SelectObject( ::hDC, If( ::lBarBtn, ::oWnd:oFont:hFont, ::oFont:hFont ) ) // method paint() befor Drawtext...

on just simple:

hOldFont = SelectObject( ::hDC, ::oFont:hFont )

and all work fine for me. Now I can use clause "FONT" in buttons on buttonbar, and even have different fonts on each button. BUT, I don't know, may be it's a wrong way, that will crash the program later or something like that...
To say the truth, I'm not quite understand, why we have to use the font from parent window? Why don't use define font from btnbmp?

Best regards!

Sergey (Loach) Abelev

fwh 9.04/xHarbour 1.2.1 (Rev. 6406)/Bcc55
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Newbie question about FWH 9.03
Posted: Sat Apr 04, 2009 08:42 AM

Sergey,

> I'm not quite understand, why we have to use the font from parent window?

Fonts can be reused as they keep a counter, so they share the same Windows GDI object. This saves memory consume. Its good to reuse them :-)

Also the idea is that the buttonbar shows the same font as its container window, by default.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion