[Gambas-user] Explanations about stock icons and dark theme

Gianluigi gradobag at gradobag.it
Tue Feb 21 15:01:40 CET 2023

Il 21/02/23 10:24, Gianluigi ha scritto:
> Il 21/02/23 00:40, Benoit Minisini ha scritto:
>> If you want the button icon to be the same whatever the theme, then 
>> don't use the Stock class or Picture["icon:/..."]!
>> Regards, 
> Hi Benoit
> I thank you very much for the further explanation, now I understand.
> But I wish to use the stock icons, the ones from Gambas theme which I 
> find very beautiful!
> I suppose the Stock["24/$(mime)" &/ sIcon] trick only works if the 
> Gambas IDE is present, or does it not?
> There would be the possibility of copying the component folders, or 
> just the icons of interest
> But whichever way is chosen there remains the problem of adapting them 
> to the font format used by the theme. 

Hi Benoit,

scusa se sono noioso, ma come ben sai io di programmazione capisco poco.

Intendevo chiedere questo:

Se io scrivo un progetto con questo codice anche gli altri vedono le 
stesse icone che vedo io?

Vedi immagine allegata.

Oppure funziona solo se si ha installata la IDE?


' Gambas class file

' For this test, I checked the components: gb.form.stock e gb.util

Public Sub Form_Open()

   Dim hCont As Panel
   Dim hButton As Button
   Dim aIconNames As String[] = ["zoom-in", "user-group", "user", 
"screen", "science", "remove", "scanner", "print", "open", "mail", 
"logout", "last", "language", "important", "info", "indent", "help", 
"game", "folder-home", "floppy", "first", "find", "edit", "download", 
"development", "desktop", "computer", "component", "color", "close", 
"bookmark", "book", "battery", "audio", "archive", "add", "access"]
   Dim sIcon As String

   With Me
     .Arrangement = Arrange.Vertical
     .Margin = True
     .Spacing = True
   End With
   For I As Integer = 0 To 5
     With hCont = New Panel(Me)
       .Name = "Panel" & CStr(I + 1)
       .Height = 35
       .Arrangement = Arrange.Horizontal
       .Spacing = True
     End With
     For C As Integer = 0 To 5
       With hButton = New Button(hCont) As "Button"
         sIcon = aIconNames[aIconNames.Max]
         .Height = 35
         .Width = 35
         .Name = "btn" & string.UCaseFirst(sIcon)
         .Picture = Stock["24/$(mime)" &/ aIconNames.Pop()]
       End With


Public Sub Button_Click()

   Print Last.Name


Best Regards


-------------- next part --------------
A non-text attachment was scrubbed...
Name: icons.png
Type: image/png
Size: 20661 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230221/723e1d77/attachment-0001.png>

More information about the User mailing list