Hello,
I guess that I am missing something obvious, but how do you set a custom image to a TGPictureButton ?
Thank you
Barth
Hello,
I guess that I am missing something obvious, but how do you set a custom image to a TGPictureButton ?
Thank you
Barth
Hi Barth,
An example you find in:
$ROOTSYS/tutorials/gui/guitest.C
Cheers
Otto
Hello Otto,
Thank you for your reply.
I am sorry, I was not clear in my first message. I would like to use an image that is not available in ROOT, an image that i would have in a directory such as /opt/xxx/yyy.
Do you think that it is possible ?
Thank you,
Barth
Hi Barth,
I dont know a better way than adding your picture to ROOTs Pool
providing an XPM as you get it e.g. from
static char *align32[] = {
/* columns rows colors chars-per-pixel */
"20 20 2 1",
" c black",
"% c #FDFDFE",
/* pixels */
"%%%%%%%%%%%%%%%%%%%%",
...
}
....
....
const TGPicture * pict = gClient->GetPicturePool()->GetPicture("mypicture", align32);
....
...
Note the somewhat misleading “GetPicture” for action: CreatePicture
then you can use it with its name “mypicture”
TGPicture * pict = gClient->GetPicturePool()->GetPicture(const char* name, UInt_t new_width, UInt_t new_height)
Cheers
Thank you very much, now I understand what you mean. I did not know the xpm format and didn’t realize it can be used this way.
Best regards,
Barth
HI Barth,
please look at my post of today: TGPIcturePool issue
In there I added a little example containing an even simpler way to use .xpm, .gif
Just put the picture in CWD or in a directory contained in $HOME/.rootrc
…
Gui.IconPath: $HOME/myicons:$ROOTSYS/icons
Cheers
Otto