Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: Joop Blokker on January 20, 2009, 10:24:25 PM

Title: XPButton
Post by: Joop Blokker on January 20, 2009, 10:24:25 PM
Hello José!

I must have a programmer's block.. Putting a .BMP image on an XPButton FROM FILE works as a charm, thanks for all your work!

How do I put a .BMP image that is in a resource file   on an XPbutton?

XPButton_SetBitmap asks for a handle to the bitmap and by Jove... I must be doing something very wrong, 'cause it doesn't work for me. Any idea how to get the correct Handle?

Thanks for your time!
Joop.
Title: Re: XPButton
Post by: José Roca on January 20, 2009, 11:24:43 PM
 
The XPButtonDemo.bas example, included in XPButtonDemo.zip ( http://www.jose.it-berater.org/smfforum/index.php?topic=2771.0 ) uses icons from a resource file.

If you want to use bitmaps instead, change


XPButton_SetIcon(GetDlgItem(hWnd, %IDC_FORM1_XPBUTTON), LoadImage(ghInstance, BYVAL 101, %IMAGE_ICON, 0, 0, %LR_DEFAULTCOLOR), %XPBI_NORMAL, %FALSE)


to


XPButton_SetBitmap(GetDlgItem(hWnd, %IDC_FORM1_XPBUTTON), LoadImage(ghInstance, BYVAL 101, %IMAGE_BITMAP, 0, 0, %LR_DEFAULTCOLOR), %XPBI_NORMAL, %FALSE)


Of course, BYVAL 101 will be BYVAL <number that you will use to identify the bitmap in your resource file>.
Title: Re: XPButton
Post by: Joop Blokker on January 21, 2009, 06:22:40 PM
Thank you José!

Of course that is the way to do it, I must have had a Senior moment... :D

I know that the button text color normally cannot be set, yet I was hoping that XPButton would have a work-around.

I Googled and found this:  http://www.freevbcode.com/ShowCode.asp?ID=3472 (http://www.freevbcode.com/ShowCode.asp?ID=3472) where they claim "Caption with selectable font and color". Since I started with PB a long time ago, I have not touched VB6 - in fact, I did not bother installing VB6 on a new pc...  I wonder if DrawThemeText is the way to go, let me tinker a bit more...

Thanks again!
Joop. 
Title: Re: XPButton
Post by: José Roca on January 21, 2009, 07:17:34 PM
 
Quote
I know that the button text color normally cannot be set, yet I was hoping that XPButton would have a work-around.

Then it won't be a themed button. The color and font are defined by the visual style.

Quote
I Googled and found this:  http://www.freevbcode.com/ShowCode.asp?ID=3472 where they claim "Caption with selectable font and color".

It is not a themed button, but an owner draw button that mimics the appearance of an XP button.
Title: Re: XPButton
Post by: Joop Blokker on January 22, 2009, 03:49:58 PM
Aaaah..!

Oh well, then icons will do the job. Thanks again for a great tool!

Ciao for now,
Joop.

Title: Re: XPButton
Post by: Joop Blokker on January 28, 2009, 06:53:22 AM
Hello José and all!

Thanks again for the great XPButton routine, my little program looks so much better now!

I ran into a little problem and I hope some one can give me a clue.  I know that the xpbutton text color cannot be changed. Okay, I can live with that. However it appears that the color of the text of a radio option button and the color of the text of a checkbox is always black (or XP Theme defined).

For a very good reason one of my Beta Testers has set the background color to black and the text color to yellow -- he is colorblind.  You see it coming: now the text of radio option buttons and checkboxes is "invisible".

Before I go and change the zillion option buttons and checkboxes by giving them an empty text string and adding that same text next to it in a label, I hope that there is an easier solution.

Thanks in advance,
Joop Blokker.

   
Title: Re: XPButton
Post by: Patrice Terrier on January 28, 2009, 07:50:17 AM
Did you considered to create a "button" superclass?

I have explained in detail how to use it in the "SDK programming" section there:
http://www.jose.it-berater.org/smfforum/index.php?board=151.0 (http://www.jose.it-berater.org/smfforum/index.php?board=151.0).
and look at the thread named: "Take control of your buttons"
Title: Re: XPButton
Post by: Joop Blokker on January 28, 2009, 08:19:35 AM
Hi José!

Thanks for the link, I'll try to figure out what you have been cookin' in SDK.  My program is 100,000 + lines of code in... DDT :D

Have a fine day,
Joop.
Title: Re: XPButton
Post by: Joop Blokker on January 28, 2009, 08:25:31 AM
So sorry....

Bonjour Patrice...!!!  Thanks for the link!

Joop.

Title: Re: XPButton
Post by: Patrice Terrier on January 28, 2009, 10:04:52 AM
Make sure also to try, all the SDK serie, 6, 7, 8, etc.

When it comes to interface design, nothing can beat SDK coding  ;D


Title: Re: XPButton
Post by: Joop Blokker on January 28, 2009, 11:06:00 AM
Bonjour Patrice, Ça baigne...?  :)

I believe you! I just bought Paul's FireFly with the intention to make a start with SDK-style programming. I am looking forward to learn a lot of new stuff and new ways to achieve things. My main product, which is developed in the past eight years is 100% DDT & API calls, I don't have the plan to redo the code in that monster to SDK. But NEW programs will be done while learning SDK style.... Wish me luck!

Have a great day,
Joop.
Title: Re: XPButton
Post by: Patrice Terrier on January 28, 2009, 01:38:00 PM
QuoteBut NEW programs will be done while learning SDK style.... Wish me luck!

The good news when learning SDK, is that you will emancipate yourself  ;)

...