[Gambas-user] Getting the "source string" for a picture

adamnt42 at ...626... adamnt42 at ...626...
Wed Jan 21 01:26:07 CET 2015


On Tue, 20 Jan 2015 23:24:58 +0100
Tobias Boege <taboege at ...626...> wrote:

> On Wed, 21 Jan 2015, adamnt42 at ...626... wrote:
> > I need to get the "source string" for a control's Picture property (specifically a ToolButton control). However, the control's Picture property returns a picture.
> > 
> > Is there any way of determining what that source string e.g. "icon:/22/connect.png" or "img/somepic.png" is? 
> > 
> 
> I don't think that this information is anywhere. When you assign the Picture
> property, you assign a Picture object which does not contain a path.
> 
> As usual, the best way to get hold again of lost information is to not lose
> it in the first place: you can try to extend the Picture class. Add a Path
> property and override Picture's _get() and Load() methods to set the path of
> a Picture when its loaded.
> 
> Regards,
> Tobi
> 

Hmmm, bugger!

I know it is in the form configuration file, but that's of little use to me in this instance.

I was trying to implement a "Style" property for toolbars, i.e. {Default}, IconOnly, Icon+Text, TextOnly.  I can handle the first three OK, but TextOnly means I need to know that path so I can reload the picture if the user selects one of the others after selecting TextOnly. The way I look at it now, if a toolbutton has both the Picture and Text properties set in the IDE then there is no way for "experienced" users to select a shorter rendition for their use, the picture and text are always displayed.

Ce'st la vie! I guess I'll just go for the first three.

regards
Bruce


-- 
B Bruen <adamnt42 at ...3379... (sort of)>




More information about the User mailing list