cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible, when a button is pressed, to make another button show the pressed image?

Zui
Senior

In my current project i have a menu. The graphic guy decide every menu part have an icon, a text and a small arrow, all are gray end when are pressed they became blue. any way to make them all show pressed state when i click one? Or should i make a big image(mostly empty) with all 3 image on it?

Thanks

8 REPLIES 8
Martin KJELDSEN
Chief III

Hi @Zui​,

It sounds to me like your graphics guy did not know that it would make your life MUCH easier to just make one single image =) Yes, you can do what you ask, simply call bitmap.setBitmap() on your images witth the new bitmap id (The color you want) and then bitmap.invalidate();

/Martin

Martin KJELDSEN
Chief III

(But, i would just ask him to redo the image - It makes the code less complex also)

that's not clear to me, where i call the setBitmap() function? because the image should change when button is pressed, but function is called when button is released. let's say mu butto call foo(), when it is pressed it switch the image to his pressed image (and here i should call my function to change other images, but i have no idea how to intercept this event, i can't reimplement handleClickEvent because i can intercept every ClickEvent::PRESSED, but can't distingue the source of the click event) and he call his assign fuction when is released, here i can add what i want, but i need to switch image when it's pressed and holded, not released...

Zui
Senior

another problem is i should also change the color of a text, so i can't use an image, because text will change with language selected, so i really need a way to call a function when a button is pressed o make the color change when that button is holded

Zui
Senior

EDIT: i solved, thanks for hints!

Martin KJELDSEN
Chief III

Great, @Zui​,

I'm assuming you figured out that you can change the color of a text programatically.

/Martin

well, i'm not that unskilled, problem was change only when button was clicked and holded and chage it back when button was released(both released with his function called, and released my mocing finger away like when u change your mind or have pressed the wrong button, but i made that work by messing around with handleClickEvent and handleDragEvent

I know, i'm Just highlighting it here for others to see if they were wondering what you did.

Best regards,

Martin