Possible a text-adjust of BTNBMP NO image ?

Possible a text-adjust of BTNBMP NO image ?

Postby ukoenig » Fri Feb 20, 2015 1:03 pm

Hello,

is it possible to adjust the prompt of BTNBMP without using a image ( to the left ) ?
I noticed the text is always centered without using a image.
TOP, LEFT, BOTTOM and RIGHT belongs to a button-image.
I need the Prompt-text adjusted to the LEFT ( NO IMAGE used ),
near to a painted image ( right border ).
Maybe as well right adjusted using a left Image-border.
It means buttons ( visible text ) be painted closed to a defined area

A sample

Image

best regards
Uwe :?:
Last edited by ukoenig on Fri Feb 20, 2015 4:17 pm, edited 1 time in total.
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: Possible a text-adjust of BTNBMP without a image ?

Postby karinha » Fri Feb 20, 2015 1:33 pm

Maybe:

Code: Select all  Expand view  RUN

   oBtn:BtnAdjust()
   oBtn:Refresh()
 


Regards

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Possible a text-adjust of BTNBMP NO image ?

Postby nageswaragunupudi » Fri Feb 20, 2015 5:00 pm

Please do not specify any prompt or bitmap and use oBtn:bPainted to draw the prompt as you want.
Regards

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

Re: Possible a text-adjust of BTNBMP NO image ?

Postby ukoenig » Sat Feb 21, 2015 12:15 am

searching in class TBTNBMP I found this part :

defined caption
NO image
nLayout := 2
result => nTxtLeft := 4


if ! Empty( ::cCaption )
--- case ::nLayOut == 2 // left
------if ::lAdjust
---------nTxtLeft := 4
------else
---------if !empty( hBmp )
------------nTxtLeft := nBmpLeft + nBmpWidth + 4
------------nLayOut := 4
-------- else
----------- nTxtLeft := 4
--------endif

tested, but no result

Code: Select all  Expand view  RUN

if ! Empty( ::cCaption )
         DEFAULT ::nLayOut := 1
         do case
              ...
              ...
               case ::nLayOut == 2 // left
               nTxtTop := ::nHeight / 2 - ( ::nGetChrHeight() * nLine ) / 2
               if ::lAdjust
                  nTxtLeft := 4
               else
                  if !empty( hBmp )
                     nTxtLeft := nBmpLeft + nBmpWidth + 4
                     nLayOut := 4
                  else
                     nTxtLeft :=  4
                  endif
            endif
            ...
            ...
 


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

Re: Possible a text-adjust of BTNBMP NO image ?

Postby nageswaragunupudi » Sat Feb 21, 2015 12:54 am

Code: Select all  Expand view  RUN
function TryThis()

   local oDlg, oFont, oBtn, oBrush

   DEFINE BRUSH oBrush FILE "penguins.jpg" RESIZE // use any jpg
   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-20 BOLD
   DEFINE DIALOG oDlg SIZE 500,400 PIXEL BRUSH oBrush

   @ 60,30 BTNBMP oBtn SIZE 200,20 PIXEL OF oDlg TRANSPARENT
   oBtn:bPainted := { || oBtn:Say( 4,10,"Button Prompt", CLR_YELLOW, nil, oFont, .t., .t. ) }

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont
   RELEASE BRUSH oBrush

return nil
 
Regards

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

Re: Possible a text-adjust of BTNBMP NO image ?

Postby ukoenig » Sat Feb 21, 2015 1:12 am

Thank You very much,

I still found another solution never tested before.
Only these two lines needed ?

@ 220, 218 BTNBMP oBtn[9] OF oDlg ;
SIZE 55, 25 PIXEL 2007 ;
NOBORDER ;
PROMPT "&Exit" ;
ACTION oDlg:End() ;
FONT oFont1 ;
LEFT
oBtn[9]:nLayOut := 4
oBtn[9]:lAdjust := .T.

oBtn[9]:lTransparent := .t.
oBtn[9]:cToolTip = { "Exit" + CRLF + "Color","Color-Selection", 1, CLR_BLACK, 14089979 }
oBtn[9]:nClrText := { | lMouseOver | If( lMouseOver, 0, 0 ) }

Image

best regards
Uwe :?:
Last edited by ukoenig on Sat Feb 21, 2015 1:17 am, edited 2 times in total.
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: Possible a text-adjust of BTNBMP NO image ?

Postby nageswaragunupudi » Sat Feb 21, 2015 1:16 am

May I know which version are you using?
I request you not to depend on internals.
When there is no bitmap, prompt is centered in all cases.( v 15.01 )
Please follow my suggested solution.
Regards

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

Re: Possible a text-adjust of BTNBMP NO image ?

Postby ukoenig » Sat Feb 21, 2015 1:23 am

I only included BTNBMP.prg from FWH /Source-directory
in my MAKE-file without any changes after viewing the file.

I'm using the latest FWH-release.

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

Re: Possible a text-adjust of BTNBMP NO image ?

Postby ukoenig » Sat Feb 21, 2015 1:35 am

Funny !

I deleted BTNBMP from my MAKE-file, to test the original release.
It doesn't work anymore !!!

Is BTNBMP.prg from directory /source different to the compiled release ( libs ) ?

FiveH.lib => 22.12.14
FiveHC.lib =>16.12.14
Five.Hx.lib => 22.12.14
BtnBmp.prg => 16.12.14

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

Re: Possible a text-adjust of BTNBMP NO image ?

Postby nageswaragunupudi » Sat Feb 21, 2015 5:16 am

Is BTNBMP.prg from directory /source different to the compiled release ( libs ) ?

No.
Regards

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

Re: Possible a text-adjust of BTNBMP NO image ?

Postby ukoenig » Sat Feb 21, 2015 1:31 pm

Mr. Rao,

I tested Your sample, but there is NO prompt displayed
Using it inside my tools, it will be a problem in case it works only with January 2015
I'm trying to get everything working also using older FWH-versions.

Image

Code: Select all  Expand view  RUN

#include "fivewin.ch"
 
STATIC c_path, c_path1
 
FUNCTION MAIN()
local oDlg, oFont, oBtn, oBrush
 
SETBALLOON( .T. )
 
c_path := cFilePath(GetModuleFileName( GetInstance() ) )
c_path1 := c_Path + "BITMAPS\"

DEFINE BRUSH oBrush FILE c_path1 + "
Picture3.jpg" RESIZE // use any jpg
DEFINE FONT oFont NAME "
VERDANA" SIZE 0,-20 BOLD
DEFINE DIALOG oDlg SIZE 500,400 PIXEL BRUSH oBrush TITLE "
  FiveWin  Version: " + FWVERSION

@ 60,30 BTNBMP oBtn SIZE 200,20 PIXEL OF oDlg TRANSPARENT
oBtn:bPainted := { || oBtn:Say( 4,10,"
Button Prompt", CLR_YELLOW, nil, oFont, .t., .t. ) }

ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
RELEASE BRUSH oBrush

RETURN NIL


Maybe a release-problem ?

January 2015
============


* Enhancements to TBtnBmp class:
(a) FILE or RESOURCE clauses can be used to load bmpfiles or resources.
(b) Uses ReadPalBmpEx() to read/load image files/resources, so any bitmap
source can be used.
(c) Where the image is too large, it is resized to fit the size of the button
(d) When ButtonBar is created with 2013 style, BtnBmp class is recoginzing it as
pre-2007 style. Now fixed.
(e) Improved painting of Grayed bitmaps
(f) Improved quality of painting non-transparent images where lBmpTransparent is .f.
(g) There was some deteoration ofquality of painting of bitmaps on pre-2007 style
buttons. Now fixed
(h) BtnBmp now supports :bPainted.

best regards
Uwe :?:
Last edited by ukoenig on Sat Feb 21, 2015 1:41 pm, edited 1 time in total.
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: Possible a text-adjust of BTNBMP NO image ?

Postby ukoenig » Sat Feb 21, 2015 1:45 pm

Enrico,

I just updated to 15.1 and It is working now
Very often I don't want to show any images.
Thanks to Mr. Rao for the info.

added :

@ 90,30 BTNBMP oBtn2 SIZE 200,20 PIXEL OF oDlg TRANSPARENT
oBtn2:bPainted := { || ( nColor := If( oBtn2:lMOver, 255, CLR_YELLOW ), ;
oBtn2:Say( 4,10,"Mouse over", nColor, nil, oFont, .t., .t. ) ) }


Image

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

Re: Possible a text-adjust of BTNBMP NO image ?

Postby ukoenig » Sun Feb 22, 2015 12:24 pm

Mr. Rao,

is it possible, to add a ACCELERATOR like on a normal button ?

oBtn:bPainted := { || ( nColor := If( oBtn:lMOver, 255, 0 ), ;
oBtn:Say( 5, 5, "Test", nColor, NIL, oFont, .T., .T. ) ) }


instead of a normal text, I added a second button-column
getting a image- AND text-change on focus.
A accelerator would make it perfect

Image

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

Re: Possible a text-adjust of BTNBMP NO image ?

Postby ukoenig » Sun Feb 22, 2015 3:01 pm

I added some lines in class BTNBMP ( NO other changes !!! )
for a missing prompt-adjustment with NO images.
Maybe possible, to include them ?
After many tests, I coudn't detect any problems.
The change keeps everything like accelerators and style 2007 as well the other paintings.

only one line to be added for buttons without images :

oBtn:nLayOut := 2 or 4 // left or right
or
oBtn:nLayOut := 0 // centered text
TOP and BOTTOM not needed.

DOWNLOD samples 1.1 MB ( EXE and PRG )
http://www.pflegeplus.com/DOWNLOADS/Btnprompt.zip

Please copy BtnBmp.prg from the /Source -directory to the install-dir and add these lines !!!
( release 15.1 tested )

Code: Select all  Expand view  RUN

METHOD PaintCaption() CLASS TBtnBmp
..
..
  if ! Empty( ::cCaption )

    If ::nLayOut == LAYOUT_LEFT
              nStyle   := DT_LEFT + DT_WORDBREAK + DT_TOP  
    elseif ::nLayOut == LAYOUT_RIGHT
              nStyle   := DT_RIGHT + DT_WORDBREAK + DT_TOP  
    endif
 


Tested ALL possible combinations after adding the new lines
I noticed maybe BOTTOM needs a little adjustment.


Image

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 40 guests