April 26, 2024, 02:14:59 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Ebasic Custom Button Designer II, using bitmap buttons

Started by AdrianFox, November 24, 2011, 02:54:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AdrianFox

Question for Larry Mc.

I've created bitmap buttons using the Custom Button Designer (Ebasic version)

Is there any way I can incorporate the bitmap as a resource in creating the button?  I've tried the normal way but I can't figure out how I would load a bitmap from memory with:

MYPIC= LOADIMAGE(1,@IMGBITMAP) 'to load into memory conventionally but then,

SetCB_BitMapLM(d1,MyButton,"filepath",0)

I wondered if I should be able to use showimage to show the picture at the button location, but that doesn't work either.

If it can't be done ok, but I expect it may be possible.

Thanks

:)
Adrian Fox

LarryMc

With the way the code is written it HAS to be from a filename.

One solution would be to add the file as a resource.
When the app is run you could use the resource to recreate the file.
That is, read the resource into a bitmap then save the bitmap to a temp file.
The name of that file would be the one you need.

Then after you get it loaded in the app you could delete the temp file.
If I ever get time to go back to that designer I'll fix it so it can be loaded from a resource.

At the rate i am going I might not ever get back to it.
I'm currently working on the IWB3 IDE.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

AdrianFox

November 25, 2011, 09:34:00 AM #2 Last Edit: November 25, 2011, 09:59:53 AM by AdrianFox
Thanks for the advice, especially as I know you are really busy with the IWB3 IDE.  More than anything I wanted to check I'd not missed something obvious, as the buttons look really good.  

WHOOPS! I wrote the text highlighted below before I ported the program to my Desktop computer.  Of course, with different screen resolution the mousex and mousey coordinates are different so my "buttons" don't work there.
What should I be looking at to overcome that problem, or would it be easier to go back to your suggestion of sticking with bitmap buttons and writing to disk on opening the program?



I've taken a different route now using "buttons" created from scalable images and then using mousex and mousey to check if the user clicks in that area.  Bit more fiddly with the code but works ok.
Thanks again,

:) :)
Adrian Fox

AdrianFox

UPDATE

Sorry, just found this discussion on the forum which shows you how to load a bitmap image from resources to use with a button in 2006.  Found MRainey's contribution most useful with the code.  Seems to work ok.

http://www.ionicwind.com/forums/index.php?topic=1179.0

thanks
Adrian Fox