DCPUSHBUTTONXP bitmap align problem

This forum is for eXpress++ general support.
Post Reply
Message
Author
zolifree
Posts: 35
Joined: Sun Sep 19, 2010 6:55 am

DCPUSHBUTTONXP bitmap align problem

#1 Post by zolifree »

Hi Roger,

I need buttons with caption and bitmap. And I want the caption on the left and the bitmap on the right on the buttons.
But it is not works well.
The DCPUSHBUTTONXP ... BITMAP ... ALIGN not works at all, if I use the ALIGN part. If try XBPALIGN_RIGHT or XBPALIGN_LEFT, it is not works as supposed.

If I use the CONFIG with DC_XbpPushButtonXPConfig(), I can do a little more this way, but that is not good too.
If the height of the bitmap is greater than the height of the button, and the bitmap is right aligned in the CONFIG, then it is not works (first button)
In my case I use much higher height bitmaps than the button heights, because the user will define the buttons, by giving the caption and the bitmap file.
He can use multiline buttons, which is 2-3 times higher than normal buttons, and the bitmap has to be good independent of the height of the button.

This is a test program which shows all the problems:

Code: Select all

#include "dcdialog.ch"
#include "dccolor.ch"

function main() 
local getlist:={},oconfig1,oconfig2,getoptions,wfile:="Cancel2.bmp"
oConfig1 := DC_XbpPushButtonXPConfig():new()
oConfig1:fgColorMouse := GRA_CLR_BLACK
oConfig1:bgColorMouse := GRA_CLR_RED
oConfig1:fgColor := GRA_CLR_WHITE
oConfig1:bgColor := GRA_CLR_BROWN
oConfig1:bgColorClick := GRA_CLR_YELLOW
oConfig1:alignBitmap=XBPALIGN_RIGHT+XBPALIGN_VCENTER
oConfig1:alignCaption=XBPALIGN_HCENTER+XBPALIGN_VCENTER
oConfig2 := DC_XbpPushButtonXPConfig():new()
oConfig2:fgColorMouse := GRA_CLR_BLACK
oConfig2:bgColorMouse := GRA_CLR_RED
oConfig2:fgColor := GRA_CLR_WHITE
oConfig2:bgColor := GRA_CLR_BROWN
oConfig2:bgColorClick := GRA_CLR_YELLOW
oconfig2:alignBitmap=XBPALIGN_LEFT+XBPALIGN_VCENTER
oConfig2:alignCaption=XBPALIGN_HCENTER+XBPALIGN_VCENTER
DC_BitmapTransparentColor( { 192, 192, 192 } )

@ 0,0 DCPUSHBUTTONXP SIZE 25, 1 CAPTION '1.Test right' FONT '12.Arial Bold'  ;
   BITMAP wfile OFFSET 10  CONFIG oConfig1

@ 2,0 DCPUSHBUTTONXP  SIZE 25, 2  CAPTION '2.Test right' FONT '12.Arial Bold'  ;
   BITMAP wfile OFFSET 10 CONFIG oConfig1

@ 5,0 DCPUSHBUTTONXP SIZE 25, 1  CAPTION '3.Test left' FONT '12.Arial Bold' ;
   BITMAP wfile OFFSET 10 CONFIG oConfig2

@ 7,0 DCPUSHBUTTONXP SIZE 25, 2 CAPTION '4. Test left 2'  FONT '12.Arial Bold' ;
   BITMAP wfile OFFSET 10 CONFIG oConfig2

@ 10,0 DCPUSHBUTTONXP  SIZE 30, 1  CAPTION '5.Test no config left'  FONT '12.Arial Bold' ;
   BITMAP wfile OFFSET 10 ALIGN XBPALIGN_LEFT;
   COLOR GRA_CLR_WHITE,GRA_CLR_BROWN

@ 12,0 DCPUSHBUTTONXP  SIZE 30, 2  CAPTION '6.Test no config left'  FONT '12.Arial Bold' ;
   BITMAP wfile OFFSET 10 ALIGN XBPALIGN_LEFT;
   COLOR GRA_CLR_WHITE,GRA_CLR_BROWN


@ 15,0 DCPUSHBUTTONXP SIZE 30, 1 CAPTION '6.Test no config right' FONT '12.Arial Bold'  ;
   BITMAP wfile OFFSET 10 ALIGN XBPALIGN_RIGHT;
   COLOR GRA_CLR_WHITE,GRA_CLR_BROWN

@ 17,0 DCPUSHBUTTONXP SIZE 30, 1 CAPTION '7.Test no align'  FONT '12.Arial Bold' ;
   BITMAP wfile OFFSET 10; 
   COLOR GRA_CLR_WHITE,GRA_CLR_BROWN

DCGETOPTIONS AUTORESIZE 

DCREAD GUI FIT TITLE 'Button test' SETAPPWINDOW OPTIONS GetOptions 

return ""
The Cancel2.bmp is in the bitmaps folder of express++
I use Express++ 265 and tha latest xbase++ 2.0
I attached a picture from the result of the code.

For me the first button needed to work at the moment, but better correct the others too.

Best regards,
Zoltan Nagy
Attachments
buttontest.jpg
buttontest.jpg (51.38 KiB) Viewed 6483 times

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: DCPUSHBUTTONXP bitmap align problem

#2 Post by c-tec »

Hello,
look at CAPTIONARRAY with DCPUSHBUTTONXP, here you can make finetuning
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

Post Reply