Here's some code for MacOS.

#if targetMacOS
  if System.IsFunctionAvailable("GetDblTime", "Carbon.framework") then
soft declare function GetDblTime lib "Carbon.framework" () as Integer
    return GetDblTime
  elseIf System.IsFunctionAvailable("GetDblTime", "InterfaceLib") then
    soft declare function GetDblTime lib "InterfaceLib" () as Integer
    return GetDblTime
  else //something really strange has happened
    return 30
  end if
#endif

Charles Yeomans

On Dec 17, 2006, at 6:22 PM, Paul Rehill wrote:

Hi all

The RB compiler doesn't seem to like declares with CarbonLib appearing
in code for UB builds.  I was hoping it would just ignore such code if
placed within TargetCarbon conditional if statements but it seems I
have to get rid of all CarbonLib references before I can attempt to
compile the project.

Seth Willits had a class for detecting the double clicking time in a
listbox's cell which depends on code like this:

Function RetrieveDbleClickTime() As Integer
 #If TargetCarbon
   Declare Function GetDblTime Lib "CarbonLib" () as Integer
   Return GetDblTime()
 #Else
   #If TargetMacOS
     Declare Function GetDblTime Lib "InterfaceLib" () as Integer
     Return GetDblTime()
   #endIf
 #endif
 #If TargetWin32
   Declare Function GetDoubleClickTime Lib "User32.DLL" () as Integer
   Return GetDoubleClickTime() / 1000 * 60
 #endif
End Function

What is the best way to get around the compiler's problem with:

   Declare Function GetDblTime Lib "CarbonLib" () as Integer

Can the second call to:

     Declare Function GetDblTime Lib "InterfaceLib" () as Integer

be used for all Mac OS X builds from 10.1 upwards?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to