Newbie question about FWH 9.03

Newbie question about FWH 9.03

Postby Loach » Fri Apr 03, 2009 6: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
Loach
 
Posts: 41
Joined: Thu Dec 22, 2005 7:39 am
Location: Gomel, Belarus

Re: Newbie question about FWH 9.03

Postby Antonio Linares » Fri Apr 03, 2009 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Newbie question about FWH 9.03

Postby Loach » 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
Loach
 
Posts: 41
Joined: Thu Dec 22, 2005 7:39 am
Location: Gomel, Belarus

Re: Newbie question about FWH 9.03

Postby Antonio Linares » Fri Apr 03, 2009 1: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: Select all  Expand view

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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Newbie question about FWH 9.03

Postby Antonio Linares » Fri Apr 03, 2009 1: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Newbie question about FWH 9.03

Postby Antonio Linares » Fri Apr 03, 2009 1: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Newbie question about FWH 9.03

Postby ukoenig » Fri Apr 03, 2009 8: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: Select all  Expand view

      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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Newbie question about FWH 9.03

Postby Loach » Sat Apr 04, 2009 8: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
Loach
 
Posts: 41
Joined: Thu Dec 22, 2005 7:39 am
Location: Gomel, Belarus

Re: Newbie question about FWH 9.03

Postby Antonio Linares » Sat Apr 04, 2009 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 34 guests