Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Clickable SetImage in Button
Clickable SetImage in Button [message #40704] Thu, 05 September 2013 12:50 Go to next message
iST1 is currently offline  iST1
Messages: 107
Registered: August 2013
Experienced Member
There is a way to set a clickable button's background as image?
Re: Clickable SetImage in Button [message #41477 is a reply to message #40704] Fri, 20 December 2013 20:14 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
iST1 wrote on Thu, 05 September 2013 06:50

There is a way to set a clickable button's background as image?


You would need to use Chameleon to do that. See reference/Chameleon.

Or you can develop your own button - easy.

Mirek
Re: Clickable SetImage in Button [message #58708 is a reply to message #41477] Mon, 01 August 2022 16:01 Go to previous messageGo to next message
Mesimo is currently offline  Mesimo
Messages: 12
Registered: August 2022
Location: BENGEURIR
Promising Member
Hello

Can you help me

i can't set a Clickable Button with background image
Re: Clickable SetImage in Button [message #58709 is a reply to message #41477] Mon, 01 August 2022 16:12 Go to previous messageGo to next message
Mesimo is currently offline  Mesimo
Messages: 12
Registered: August 2022
Location: BENGEURIR
Promising Member
hello mr Milek

How i can develop own button - easy.if you want to give us an example


thanks
Re: Clickable SetImage in Button [message #58710 is a reply to message #58709] Mon, 01 August 2022 16:19 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Mesimo wrote on Mon, 01 August 2022 16:12
hello mr Milek

How i can develop own button - easy.if you want to give us an example

thanks

Dear Mesimo

In Reference/Chameleon there is a good example of custom buttons.
It looks like this:

index.php?t=getfile&id=6642&private=0

Please try it and tell us if it's OK for your needs.


Best regards
Iñaki
Re: Clickable SetImage in Button [message #58711 is a reply to message #58708] Mon, 01 August 2022 16:25 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Mesimo wrote on Mon, 01 August 2022 16:01
Hello

Can you help me

i can't set a Clickable Button with background image

Dear Mesimo

It's simple. With SetImage(image), you can set an image as the background of a button. You can load the Image from a file or, probably much better, from an .iml file. You have a good tutorial here.


Best regards
Iñaki
Re: Clickable SetImage in Button [message #58713 is a reply to message #58711] Mon, 01 August 2022 16:39 Go to previous messageGo to next message
Mesimo is currently offline  Mesimo
Messages: 12
Registered: August 2022
Location: BENGEURIR
Promising Member
Hello

in attached my code can you see the mistake I made
its compiled without error but the image is not displayed as background of button ( but_next )
  • Attachment: forum.JPG
    (Size: 41.88KB, Downloaded 59 times)
Re: Clickable SetImage in Button [message #58714 is a reply to message #58713] Mon, 01 August 2022 16:58 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hi Mesimo

The code doesn't look bad, although I probably would have done it differently. If you can send in a zipped file a minimal version of your project, I can send it back to you corrected.


Best regards
Iñaki
Re: Clickable SetImage in Button [message #58715 is a reply to message #58714] Mon, 01 August 2022 17:14 Go to previous messageGo to next message
Mesimo is currently offline  Mesimo
Messages: 12
Registered: August 2022
Location: BENGEURIR
Promising Member
Hello

Can you give me your number whatsapp i will send it in whatsapp or linkedin
Re: Clickable SetImage in Button [message #58716 is a reply to message #58715] Mon, 01 August 2022 17:20 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hi Mesimo

It is much simpler, you can just enclose the zipped file in a message in this forum. You will see the "File Attachments option".


Best regards
Iñaki
Re: Clickable SetImage in Button [message #58717 is a reply to message #58716] Mon, 01 August 2022 17:34 Go to previous messageGo to next message
Mesimo is currently offline  Mesimo
Messages: 12
Registered: August 2022
Location: BENGEURIR
Promising Member
Hello

I want the images in the middle to be clickable for me I did the test with images but in reality they will be button with background image


I hope you can help me I will be very grateful
  • Attachment: ihm.rar
    (Size: 1.23KB, Downloaded 47 times)
Re: Clickable SetImage in Button [message #58719 is a reply to message #58717] Mon, 01 August 2022 21:12 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Mesimo,

Please rework your example to be more simple. Just operate on one button and image (not several ones). Also optimally, use images from .iml file not from your hard drive. To do, it please follow "Adding images" tutorial.

Please reduce, your example to one window to reproduce the issue and do not use acronyms like BB (Just name it MyWindow etc.).

Klugier


U++ - one framework to rule them all.

[Updated on: Mon, 01 August 2022 22:35]

Report message to a moderator

Re: Clickable SetImage in Button [message #58720 is a reply to message #58719] Tue, 02 August 2022 00:09 Go to previous messageGo to next message
Mesimo is currently offline  Mesimo
Messages: 12
Registered: August 2022
Location: BENGEURIR
Promising Member
hello Klugier

please find attached the detailed code with a single button and image if you can help me

thanks
  • Attachment: ihm.rar
    (Size: 0.80KB, Downloaded 44 times)
Re: Clickable SetImage in Button [message #58721 is a reply to message #58720] Tue, 02 August 2022 09:54 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Mesimo

Your demo runs well. I have created a little .jpg file, with the red and black arrow, and it loads it in the button:
	    img_chad = StreamRaster::LoadFileAny("c:\\tmp\\3.jpg");
	    if (IsNull(img_chad))
	        Exclamation("Image 3.jpg not found");

And in the Paint(), I have included the Klugier advice. For this kind of images, it is better including them in .iml files. I have put one from CtrlLib/Ctrl.iml:
w.DrawImage(220, 350,180,180, CtrlsImg::O1()/*img_chad*/);

index.php?t=getfile&id=6646&private=0


Best regards
Iñaki
icon14.gif  Re: Clickable SetImage in Button [message #58722 is a reply to message #58721] Tue, 02 August 2022 11:56 Go to previous messageGo to next message
Mesimo is currently offline  Mesimo
Messages: 12
Registered: August 2022
Location: BENGEURIR
Promising Member
hello dear

really thank you very much I solved the probleme I worked by iml file now I want to eliminate the borders of the button

any ideas



thanks
Re: Clickable SetImage in Button [message #58723 is a reply to message #58722] Tue, 02 August 2022 15:04 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Mesimo

Please include a picture of the button as you have it now, and how you would like it to look.
In this way, we will unequivocally realise the design you want.


Best regards
Iñaki
Re: Clickable SetImage in Button [message #58724 is a reply to message #58723] Wed, 03 August 2022 13:04 Go to previous messageGo to next message
Mesimo is currently offline  Mesimo
Messages: 12
Registered: August 2022
Location: BENGEURIR
Promising Member
Hello

I WANT to make conditons on 2 buttons with ' if ' I used 2 method and it does not work

but_chad << [=]

but_next << [=]


if ((but_chad << [=])&& ( but_next << [=]))
{

Next();
};



the result is Eroor Lambda
Re: Clickable SetImage in Button [message #58725 is a reply to message #58724] Thu, 04 August 2022 00:13 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

You are doing it wrongly and it is not valid C++. In this case you need to have lambda per button:
but_chad << [=] { Next(); };
but_next << [=] { Next(); };


Use this tutorial for reference.

Klugier


U++ - one framework to rule them all.
Re: Clickable SetImage in Button [message #58726 is a reply to message #58725] Thu, 04 August 2022 11:00 Go to previous messageGo to next message
Mesimo is currently offline  Mesimo
Messages: 12
Registered: August 2022
Location: BENGEURIR
Promising Member

I want a condition for 2 buttons

if ( button1 clicked && button2 clicked)
{
instructions
}

Do you have any adeas

thanks

Re: Clickable SetImage in Button [message #58728 is a reply to message #58726] Thu, 04 August 2022 15:10 Go to previous message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Mesimo wrote on Thu, 04 August 2022 11:00

I want a condition for 2 buttons

if ( button1 clicked && button2 clicked)
{
instructions
}

Do you have any adeas

thanks

Hello Mesimo

You can use "Option", that is the check box in U++.
For example, if option1 and option2 have been declared as Option, you can do:
if (option1 && option2) {
           Do
}


Best regards
Iñaki
Previous Topic: Is there a way to get all character supported in a font with Font?
Next Topic: 2 Buttons clicked
Goto Forum:
  


Current Time: Fri Mar 29 02:01:44 CET 2024

Total time taken to generate the page: 0.02068 seconds