Dialog button with image.bmp --not working

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Dialog button with image.bmp --not working

Post by JRL » Fri Apr 06, 2007 9:45 pm

I think this used to work, am I doing something wrong?

I've got a dialog with a button. Dialog help says that I can call a bmp file that will display on the button. Instead I just get a totally grey button. I've got a bmp file that is a solid purple color. It is 75 pixels wide and 25 pixels tall. I made it using Microsoft Paint and I believe that it is a 24 bit bitmap. Here is a sample dialog.

Code: Select all

Dialog>Dialog1
   Caption=Dialog1
   Width=445
   Height=250
   Top=149
   Left=46
   Button=OK,168,144,75,25,3,C:\purple.bmp,This is a hint
EndDialog>Dialog1

Show>dialog1,r1

Wait>0,5

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Apr 06, 2007 10:14 pm

Hi!

What OS and UI are you using? I tried this in XP with windows classic. I can see that it is affecting the button, because when the .bmp is added to the button command the text moves to the right as though it's allocating real estate for it (my .bmp was maybe 20x20), but the .bmp itself isn't displayed. I'll try it later with XP with the XP UI and see if that makes a difference.

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Apr 06, 2007 10:24 pm

Using XP with the "Classic" interface (I'm old so I like the classics) :wink:

Yes if I make the bmp small it pushes the text to the right of the button. On the other hand, if I make the bmp large, the button disappears although it still functions.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Apr 06, 2007 10:59 pm

I tried on XP/XP (barf) but unfortunately it's the same, moves the text but doesn't display so there's something else going on.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sat Apr 21, 2007 3:36 pm

Ok, this had me scratching my head. I have a whole bunch of bitmaps that work fine, but when I tried to create one with Paint as you had I got the same problem. Then I discovered something I didn't know:

"The lower left pixel of the bitmap is reserved for the "transparent" color. Any pixel in the bitmap which matches that lower left pixel will be transparent."

So if the entire image is the same colour it won't appear - it will appear transparent. What you want to do is give your bitmaps a border if you want a solid colour. If you draw an image "inside" your bitmap, you'll see that image on the button and the "background" will be transparent.

I'll update the help file with this information.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Sat Apr 21, 2007 6:17 pm

mtettmar wrote:"The lower left pixel of the bitmap is reserved for the "transparent" color. Any pixel in the bitmap which matches that lower left pixel will be transparent."
Ahh, could this also affect the ScreenCapture routine?

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sat Apr 21, 2007 6:25 pm

No, it has nothing at all to do with ScreenCapture.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Apr 21, 2007 7:05 pm

Wow, that's an obscure one. But sure enough, I edited just that pixel and the .bmp shows. Is this an internal windows thing, or are there likely to be other situations/apps where a single color .bmp won't show?

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Apr 23, 2007 4:33 pm

Thank you Marcus. Very impressive that you figured this one out. :D

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Mon Apr 23, 2007 5:15 pm

My compliments as well Marcus... and quite timely as I expect the upcoming ability to include image data within the macro itself will result in a lot more users putting images on dialog buttons (I know it will for me anyway). :D

And thanks in advance for updating the Help file with details about the special significance of the lower left corner pixel. Not knowing that has probably discouraged some from putting images on buttons. Having that info right in the Help File is the handiest and best place for it to be.

All the best and take care
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Apr 23, 2007 8:26 pm

If you have a bunch of .bmp's to modify then imagemagick works great in combination with macroscheduler.

//change the lower left pixel to a color unlikely to be in the image

Let>RP_WAIT=1
//create a 1x1 pixel .bmp
RunProgram>c:\imag\convert -size 1x1 xc:#FF00FF c:\test\fuschia.bmp
//place it on the original .bmp
RunProgram>c:\imag\composite -gravity southwest c:\test\fuschia.bmp c:\test\square.bmp c:\test\comp.bmp

Or:

//add an invisible border (avoids having a missing lower left pixel)

RunProgram>c:\imag\convert -bordercolor #FF00FF -border 1x1 c:\test\square1.bmp c:\test\square1.bmp

Or if you want a visible border, you need to add an invisible one outside:

Let>RP_WAIT=1
//add a 3 pixel visible red border
RunProgram>c:\imag\convert -bordercolor #FF0000 -border 3x3 c:\test\square.bmp c:\test\square1.bmp
//add 1 pixel fuschia outer border which will be transparent
RunProgram>c:\imag\convert -bordercolor #FF00FF -border 1x1 c:\test\square1.bmp c:\test\square1.bmp

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Mon Apr 23, 2007 8:53 pm

Hi Me_again,

Thanks for sharing that; added to snippets for later use. :)
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts