
If it's not possible, then a function to get the doubleclick time (like GetDoubleClickTime_() but crossplatform)

A cross-platform procedure to obtain the double click time:Polo wrote:If it's not possible, then a function to get the doubleclick time (like GetDoubleClickTime_() but crossplatform)
Code: Select all
EnableExplicit
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
ImportC ""
GetDblTime()
EndImport
CompilerEndIf
Procedure.I GetDoubleClickTime()
Protected DoubleClickTime.I
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Linux
Protected GValue.GValue
Protected *Settings.GtkSettings
GValue\g_type = 6 << 2
*Settings = gtk_settings_get_default_()
If *Settings
g_object_get_property_(*Settings, "gtk-double-click-time", @GValue)
EndIf
DoubleClickTime = g_value_get_int_(@GValue)
CompilerCase #PB_OS_MacOS
DoubleClickTime = Int(GetDblTime() * 16.666667)
CompilerCase #PB_OS_Windows
DoubleClickTime = GetDoubleClickTime_()
CompilerEndSelect
ProcedureReturn DoubleClickTime
EndProcedure
MessageRequester("Info", "Double click time = " + Str(GetDoubleClickTime()) + " ms")
16.6?Shardik wrote:Code: Select all
CompilerCase #PB_OS_MacOS DoubleClickTime = Int(GetDblTime() * 16.666667)
TomS wrote:16.6?
I have no Mac, but this seems odd.
I read somewhere that some languages return the DoubleClickTime in CPU ticks rather than milliseconds.
If that's the case for the MacOS Api, 16.6 is an experimental value that may very well be different on another system. But in that case it rather be "divided by" and the number had to be higher.
Still this seems like an experimanel value.
Are you certain that is correct on each Mac?
1 Tick = 1/60 sec = 16.666667 msApple's Carbon Event Manager Programming Guide wrote:The Classic Event Manager function GetDblTime returns the current value of this interval, expressed in ticks (sixtieths of a second, the time unit used by earlier versions of Mac OS).
Shardik wrote:I even made the effort to verify different double click times with a stop watch on my Mac after changing them repeatedly in the System Settings!
Thanks!freak wrote:I added the double click events and a native DoubleClickTime() function as well