an image on btnbmp and other

an image on btnbmp and other

Postby Silvio.Falconi » Wed May 23, 2018 10:20 am

I wish Know if I can make it with btnbmp

I need to put the number on bottom angle left and a small image on top angle right

the umbrella image at the center

as this image

Image

How I can set the color when I press a button ?

I wish when I select many buttons the buttons must be pressed. this because when I make a multiple selection can I insert on order many umbrellas

it is possible with Btnbmp ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: an image on btnbmp and other

Postby nageswaragunupudi » Wed May 23, 2018 2:09 pm

Code: Select all  Expand view  RUN
function Test()

   local oDlg, oFont, aBtn[ 7 ]
   local nRow, nCol, n

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   DEFINE DIALOG oDlg SIZE 600,200 PIXEL TRUEPIXEL FONT oFont

   nRow  := 50
   nCol  := 30

   for n := 1 to 7
      @ nRow, nCol BTNBMP aBtn[ n ] RESOURCE "c:\fwh\bitmaps\alphabmp\world.bmp" ;
         PROMPT LTrim( Str( n ) ) + " " ;
         SIZE 64,64 PIXEL OF oDlg FLAT TOP COLOR CLR_WHITE,CLR_GREEN NOBORDER

      WITH OBJECT aBtn[ n ]
         :Cargo      := n
         :bAction    := { |oBtn| oBtn:Toggle() }
         :bPainted   := { |hDC| FW_DrawImage( hDC, "c:\fwh\bitmaps\alphabmp\task.bmp", { 2, 30, 34, 62 } ) }
         :bClrGrad   := { |l,oBtn| If( oBtn:lPressed, CLR_HRED, CLR_GREEN ) }
      END
      nCol  += 80
   next n

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: an image on btnbmp and other

Postby Silvio.Falconi » Wed May 23, 2018 3:56 pm

thanks,

but I believe I cannot use it because I also an oldest release of fwh

because I not have FW_DrawImage() is there another solution ?
How I can change the color of text ( back and fore) I need to create a small box to insert the number and change this with different color .
sample :change the box of text with clr_red background if the customer has not payed also

it run also with Png ?

I 'm thinking ...I must make a purchase now
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: an image on btnbmp and other

Postby Otto » Wed May 23, 2018 6:34 pm

Dear Mr Rao,

can you please show me on this example how to get this working.

:bPainted := { |hDC| DrawText( hDC, LTrim( Str( n ) ) + " " , { 2, 30, 34, 62 } ) }

In my case it is always 8.

How can I add to more textlines to the button with different fonts.

Thank you in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: an image on btnbmp and other

Postby cnavarro » Wed May 23, 2018 7:22 pm

Otto, try with
Code: Select all  Expand view  RUN

FW_SayText( oWnd, cText, aRect, cAlign, oFont, nClrText, nClrBack, lBorder, nAddStyle )   // oWnd or hDC
 


Mr Rao, it's Ok ?

Who return these functions?
? FW_SayText( oWnd, cText, aRect, cAlign, oFont, nClrText, nClrBack, lBorder, nAddStyle )   // oWnd or hDC
? FW_DrawImage( hDC, "c:\fwh\bitmaps\alphabmp\task.bmp", { 2, 30, 34, 62 } ) }
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: an image on btnbmp and other

Postby Otto » Wed May 23, 2018 7:33 pm

Dear Cristobal,
here is the same problem with the values.
We need to use detached locals but I can’t get it working.
It it works for the different fonts I have to check.
Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: an image on btnbmp and other

Postby Silvio.Falconi » Wed May 23, 2018 7:58 pm

Otto wrote:Dear Mr Rao,

can you please show me on this example how to get this working.

:bPainted := { |hDC| DrawText( hDC, LTrim( Str( n ) ) + " " , { 2, 30, 34, 62 } ) }

In my case it is always 8.

How can I add to more textlines to the button with different fonts.

Thank you in advance
Otto



Also here

Image

I wish Know :
1. How have an array with the umbrellas selected ...
2. how change the number color background and create a small box as you can see on first snapshot


with FW_SayText(aBtn[ n ], "k", { 2, 30, 34, 62 }, , oFont, CLR_BLACK, CLR_WHITE, .T., ) not happen nothing

with :bPainted := { |hDC| FW_SayText(hdc, "k", { 2, 30, 34, 62 }, , oFont, CLR_BLACK, CLR_WHITE, .T., ) }

I have a result but allways 8
Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: an image on btnbmp and other

Postby cnavarro » Wed May 23, 2018 8:23 pm

Otto wrote:Dear Cristobal,
here is the same problem with the values.
We need to use detached locals but I can’t get it working.
It it works for the different fonts I have to check.
Best regards
Otto


Otto, one idea is

Code: Select all  Expand view  RUN

   :Cargo  :=  LTrim( Str( n ) )
   :bPainted := { | hDC, cP, oBtn | DrawText( hDC, oBtn:Cargo + " " , { 2, 30, 34, 62 } ) }
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: an image on btnbmp and other

Postby Silvio.Falconi » Wed May 23, 2018 8:44 pm

Cristobal,
Otto's idea run ok here

but I wish is possible create a colored box arround the text is on the left angle

Image

how I can save an array with all btns pressed ?
if aadd(obtn:cargo) give me allways 8
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: an image on btnbmp and other

Postby Silvio.Falconi » Wed May 23, 2018 9:03 pm

Otto,
mycent...

try with

:bPainted := { | hDC, cP, oBtn | DrawText2(hDC, oFont:hFont, 1, LTrim( Str(oBtn:Cargo)) + " " ,2, 30, 34, 62, CLR_WHITE )}


FUNCTION DrawText2( hDC, hFont, nBkMode, cText, nTop, nLeft, nWidth, nHeight,color )
LOCAL hFontOld:= SelectObject( hDC, hFont )
LOCAL nBkOld := SetBkMode( hDC, nBkMode )
SetTextColor( hDC, color )
DrawText( hDC, cText, { nTop, nLeft, nTop+nWidth, nLeft+nHeight } )
SelectObject( hDC, hFontOld )
SetBkMode( hDC, nBkOld )
RETURN( NIL )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: an image on btnbmp and other

Postby Otto » Wed May 23, 2018 9:06 pm

Dear Cristobal,
thank youso much. With cargo it is working.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: an image on btnbmp and other

Postby Silvio.Falconi » Wed May 23, 2018 9:13 pm

and with...
:bPainted := { | hDC, cP, oBtn | DrawText2(hDC, oFont:hFont, 2, LTrim( Str(oBtn:Cargo)) + " " ,2, 20, 34, 62,CLR_WHITE, CLR_RED )}




FUNCTION DrawText2( hDC, hFont, nBkMode, cText, nTop, nLeft, nWidth, nHeight,color,color2 )
LOCAL hFontOld:= SelectObject( hDC, hFont )
LOCAL nBkOld := SetBkMode( hDC, nBkMode )
SetTextColor( hDC, color )
setBkColor( hDC, color2 )
DrawText( hDC, cText, { nTop, nLeft, nTop+nWidth, nLeft+nHeight } )
SelectObject( hDC, hFontOld )
SetBkMode( hDC, nBkOld )
RETURN( NIL )


you have

Image

Otto the button is nice, right?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: an image on btnbmp and other

Postby Otto » Wed May 23, 2018 9:44 pm

Hello Silvio, yes very nice.
Regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: an image on btnbmp and other

Postby nageswaragunupudi » Wed May 23, 2018 10:58 pm

Code: Select all  Expand view  RUN
function TestCurrent()

   local oDlg, oFont, oBtn, aBtn[ 7 ]
   local nRow, nCol, n

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   DEFINE DIALOG oDlg SIZE 600,200 PIXEL TRUEPIXEL FONT oFont

   nRow  := 50
   nCol  := 30

   for n := 1 to 7
      @ nRow, nCol BTNBMP aBtn[ n ] RESOURCE "c:\fwh\bitmaps\alphabmp\world.bmp" ;
         SIZE 64,64 PIXEL OF oDlg FLAT TOP COLOR CLR_WHITE,CLR_GREEN NOBORDER

      WITH OBJECT ( oBtn := aBtn[ n ] )
         :Cargo      := n
         :bAction    := { |oBtn| oBtn:Toggle() }
         :bClrGrad   := { |l,oBtn| If( oBtn:lPressed, CLR_HRED, CLR_GREEN ) }
      END
      nCol  += 80
   next n

   for each oBtn in aBtn
      oBtn:bPainted   := { |hDC| FW_DrawImage( hDC, "c:\fwh\bitmaps\alphabmp\task.bmp", { 2, 30, 34, 62 } ), ;
                                 FW_SayText( hDC, oBtn:Cargo, { 40, 2, 63, 25 },,oFont, CLR_HRED, nARGB(255,CLR_YELLOW), .t. ) }

   next

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 


Image

nClrBack in FW_SayText(...) can be
1) Color value
2) Alpha Color
3) oBrush or hBrush

In case of (2) and (3), entire rectangle is filled with the color/brush.
In case of (1) the text is painted using nClrText/nClrBack within the rectangle.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: an image on btnbmp and other

Postby nageswaragunupudi » Wed May 23, 2018 11:37 pm

Using FW_SayText() to print multi-line text in multiple fonts:

Code: Select all  Expand view  RUN
function TestCurrent()

   local oWnd, oBold, oMedium, oSmall, cText

   DEFINE FONT oBold    NAME "COPPERPLATE GOTHIC BOLD" SIZE 0,-24
   DEFINE FONT oMedium  NAME "VERDANA" SIZE 0,-16
   DEFINE FONT oSmall   NAME "TAHOMA"  SIZE 0,-11

   cText := "This is Bold Font"              + CRLF + ;
            "Text in Medium Font"            + CRLF + ;
            "Some more text in small font"   + CRLF + ;
            "spanning multiple lines."

   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd CENTERED ;
      ON PAINT oWnd:SayText( cText, nil, nil, { oBold, oMedium, oSmall, oSmall } )

   RELEASE FONT oBold, oMedium, oSmall

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 61 guests