Autore Topic: Ottenere la "stringa di origine" per un'immagine  (Letto 772 volte)

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.309
  • Ne mors quidem nos iunget
    • Mostra profilo
Ottenere la "stringa di origine" per un'immagine
« il: 21 Gennaio 2015, 00:11:58 »
Vi riporto questa discussione:


" 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?

tia
Bruce
"


" 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
"


" 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
"


" This must be implemented in gb.form.mdi.

How the toolbar works? At the moment, it just shows or hides its
children. If it would modify the text or icon of its children, it would
lost the data.

So I think something must be added to the ToolButton control: the
ability to hide/show text and icon on demand.

Usually, the hide/show text/icon is global to the toolbar, but I find
that really useless. This is something that should be enabled or
disabled individually for each ToolButton.

What do you think?

--
Benoît Minisini
"
« Ultima modifica: 21 Gennaio 2015, 02:03:11 da vuott »
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.309
  • Ne mors quidem nos iunget
    • Mostra profilo
Re: Ottenere la "stringa di origine" per un'immagine
« Risposta #1 il: 21 Gennaio 2015, 12:42:38 »
...continua...


" > If it would modify the text or icon of its children, it would lost the data.
Yes, that is the current problem. I was working around it by modifying the toolbutton .Tag property to save the  developer set text  so it could be restored within the session. But then ran up against the problem of saving the picture.

> Usually, the hide/show text/icon is global to the toolbar, but I find that really useless.
Interesting. We have discussed this with our users and they preferred that the option to show/hide the text be at the toolbar level. Why do you think it's "useless"?

The conversation we have had went sort of like this:
[THEY] "We generally want pictures and text on every toolbar, but would like to be able to turn off the text when we are familiar with using that toolbar."
[ME] (Thinks) OK, we can customise the gb.form.mdi component to implement a Toolbar.Style property that can be changed "on demand" using the FToolbarConfig form ... and also maybe make it a Settings option.
"Do you want to be able to select the style at the toolbar level or for each button on the toolbar?"
[THEY] No, as long as there are tooltips for each button then it would be preferrable to set it at the toolbar level.

The issue we have is that there is a fairly high turnover for our client's staff.  To be more correct, they have a floating population of staff that they wish to have access to the system. Sometimes a particular trainer has a high demand for staff, sometimes lower, depending on how many horses they are managing at the time.  So people who have to use our training system come and go and come back again and go away again... (and while they are away we may have changes to the system ... ) So those users oscillate between "newbies" and "experts" all the time. Hence the need for a user configurable toolbar style (amongst a million other things :-) as usual!)

But, given what you said, I think there is a case for implementing both a toolbutton level style and also an overriding toolbar level style. However, I can't imagine at the moment the user interface required for managing individual toolbuttons. Perhaps you have an idea?

So far we have managed to do this in (our version of)) gb.form.mdi:
1) implement the Style property for the Toolbar class (it has the previously mentioned 4 values "{Default}", "IconOnly", "Icon+Text", and "TextOnly".  Of these "{Default}" means that if the button has text it will be displayed, otherwise only the icon is shown. (I've also managed to get around a problem of allowing Icon size changes to work properly when the ToolButton.Expand property is nt set to true.); "IconOnly" works fine, the original text is saved in the button .Tag property and can be restored when necessary e.g. by the user selecting "Icon+Text"; the "TextOnly" option is a failure for the original reason.
2) modify the FToolbar Config form to allow the style to be set on the fly (see Pic1 attached)
I haven't got to changing the local Settings "save" yet - I think I need to be looking at the FToolbar.SaveConfig and FToolbar.LoadConfig methods but just haven't got to that yet.

    One other thing "THEY" continue to ask for is a "Huge" option for the icon size.  This is related to our low light environment situation.          Any chance of this?

Best regards
Bruce
"


" What is the size of HUGE ?

--
Fabien Bodard
"


" I take it to mean the size from Picture["icon:/huge/something"]

Bruce
"


" "Huge" toolbar icons were implemented in revision #6854.

Regards,

--
Benoît Minisini
"
« Ultima modifica: 23 Gennaio 2015, 16:54:31 da vuott »
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »