Get Doubleclick time

Linux specific forum
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Get Doubleclick time

Post by Polo »

Hello,

I dont have Linux on my system, can somebody test the following code?
I just need this "just in case", to keep my code cross platform.

Code: Select all

    settings = gtk_settings_get_default()
    dblclicktime = 250
    g_object_get_(settings, "gtk-double-click-time", @dblclicktime, 0)
    Debug dblclicktime
Thanks!
Gaetan
User avatar
Shardik
Addict
Addict
Posts: 2067
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Get Doubleclick time

Post by Shardik »

Unfortunately your code doesn't work:

- gtk_settings_get_default_() only returns a GtkSettings object if you have opened a window
- You have to initialize your variable to contain the double click value as type GValue and G_TYPE_INT
- g_object_get() and similar functions which require lists terminated with a NULL value don't work in PB, use g_object_get_property() instead
- You have to use g_value_get_int() to obtain the Integer value of the double click time

So finally this is a working example: :wink:

Code: Select all

#G_TYPE_INT = 6 << 2

DoubleClickTime.GValue
DoubleClickTime\g_type = #G_TYPE_INT

OpenWindow(0, 200, 100, 200, 170, "Test", #PB_Window_Invisible)

*Settings.GtkSettings = gtk_settings_get_default_()

If *Settings
  g_object_get_property_(*Settings, "gtk-double-click-time", @DoubleClickTime)
  MessageRequester("Info", "Double click time = " + Str(g_value_get_int_(@DoubleClickTime)) + " ms")
EndIf
Last edited by Shardik on Thu May 26, 2011 4:33 pm, edited 1 time in total.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Get Doubleclick time

Post by Polo »

Thanks Shardik, guess i should install linux to understand more the way it works! :)
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Get Doubleclick time

Post by ts-soft »

>>> #PB_Window3D_Invisible :mrgreen:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Shardik
Addict
Addict
Posts: 2067
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Get Doubleclick time

Post by Shardik »

ts-soft wrote:>>> #PB_Window3D_Invisible :mrgreen:
Doesn't make any difference for Linux because

Code: Select all

Debug #PB_Window3D_Invisible  ; Will display 1 in Linux and Windows
Debug #PB_Window_Invisible    ; Will display 1 in Linux and 268435456 in Windows
:lol:

Nevertheless I have edited my above code example... :wink:
Post Reply