stringgadget height question

Linux specific forum
John Duchek
User
User
Posts: 83
Joined: Mon May 16, 2005 4:19 pm
Location: St. Louis, MO

stringgadget height question

Post by John Duchek »

I am working on a program that uses a lot of stringgadgets for input. it seems there are limits for the size of these that appear pretty large. In this line
StringGadget(31,300,60,140,20," ") the value of 20 for the height is very large. If I put in 10 or 15 or 0 I get the same gadget size as if I put in 20. Is that a permanent minimum or is that automatically set by the font size or something? I am using the default fonts. I need to use at least 22 of these gadget, and that is taking up a lot of window. Is there any way to make that 20 height 10??
Thanks for any help,
John
John R. Duchek
St. Louis,MO
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: stringgadget height question

Post by mk-soft »

The minimum sizes are set by the GTK3 CSS provider and may change when changing to a different theme under Linux Control Panel.

I'll have to see if I can change this with GTK3 functions.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Shardik
Addict
Addict
Posts: 1984
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: stringgadget height question

Post by Shardik »

Tested successfully on Linux Mint 19.3 'Tricia' x64 with Cinnamon and GTK3 using PB 5.73 x64:

Image

Code: Select all

#GTK_STYLE_PROVIDER_PRIORITY_APPLICATION = 600

ImportC ""
  gtk_css_provider_load_from_data(*CSSProvider, CSSData.P-UTF8, Length.I,
    *Error.GError)
  gtk_css_provider_new()
  gtk_style_context_add_provider_for_screen(*Screen.GdkScreen, *StyleProvider,
    Priority.I)
EndImport

Define CSSProvider.I
Define CSSStringInput.S
Define Screen.I

CSSStringInput = "" +
  "entry {" + #LF$ +
  "  padding-top: 0px; padding-bottom: 0px;" + #LF$ +
  "}"

CSSProvider= gtk_css_provider_new()
gtk_css_provider_load_from_data(CSSProvider, CSSStringInput, -1, 0)
Screen = gdk_display_get_default_screen_(gdk_display_get_default_())
gtk_style_context_add_provider_for_screen(Screen, CSSProvider,
  #GTK_STYLE_PROVIDER_PRIORITY_APPLICATION)
g_object_unref_(CSSProvider)

OpenWindow(0, 100, 100, 300, 103, "StringGadgets with reduced height")

For i = 0 To 2
  StringGadget(i, 20, i * 22 + 20, WindowWidth(0) - 40, 1, "")
  SetGadgetText(i, "StringGadget " + Str(i + 1) +
    " - Required height: " + GadgetHeight(i, #PB_Gadget_RequiredSize))
Next i

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: stringgadget height question

Post by mk-soft »

Thanks :wink:
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
John Duchek
User
User
Posts: 83
Joined: Mon May 16, 2005 4:19 pm
Location: St. Louis, MO

Re: stringgadget height question

Post by John Duchek »

Thank you for your responses. FYI I am using fedora33 and XFCE4. I wasn't able to run that code as I get this error Line 10: gtk_css_provider_new() is not a function, array, list, map or macro. and I haven't figured it out yet. Still I tried 19 and 18 pixels for y and it made no difference. It looks like I am stuck with that for the moment.
John
John R. Duchek
St. Louis,MO
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: stringgadget height question

Post by mk-soft »

PB Version?

Not use subsystem GTK2
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Shardik
Addict
Addict
Posts: 1984
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: stringgadget height question

Post by Shardik »

Unfortunately I am currently in my home office and can't test on my test PC at work with 22 different Linux distributions including Fedora. But I know that Fedora is a special distribution in which you have to import each GTK3 function (the GTK3 functions predefined in PureBasic are not found). Therefore you may try the following example which also imports GTK3 functions gdk_display_get_default() and gdk_display_get_default_screen() instead of using the same functions predefined in PureBasic with a trailing underscore. The modified example should work in all Linux distributions with GTK3:

Code: Select all

#GTK_STYLE_PROVIDER_PRIORITY_APPLICATION = 600

ImportC ""
  gtk_css_provider_load_from_data(*CSSProvider, CSSData.P-UTF8, Length.I,
    *Error.GError)
  gtk_css_provider_new()
  gdk_display_get_default()
  gdk_display_get_default_screen(*Display.GdkDisplay)
  gtk_style_context_add_provider_for_screen(*Screen.GdkScreen, *StyleProvider,
    Priority.L)
EndImport

Define CSSProvider.I
Define CSSStringInput.S
Define Screen.I

CSSStringInput = "" +
  "entry {" + #LF$ +
  "  padding-top: 0px; padding-bottom: 0px;" + #LF$ +
  "}"

CSSProvider = gtk_css_provider_new()
gtk_css_provider_load_from_data(CSSProvider, CSSStringInput, -1, 0)
Screen = gdk_display_get_default_screen(gdk_display_get_default())
gtk_style_context_add_provider_for_screen(Screen, CSSProvider,
  #GTK_STYLE_PROVIDER_PRIORITY_APPLICATION)

OpenWindow(0, 100, 100, 300, 103, "StringGadgets with reduced height")

For i = 0 To 2
  StringGadget(i, 20, i * 22 + 20, WindowWidth(0) - 40, 1, "")
  SetGadgetText(i, "StringGadget " + Str(i + 1) +
    " - Required height: " + GadgetHeight(i, #PB_Gadget_RequiredSize))
Next i

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Post Reply