On Dec 17, 2006, at 3: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.

That's because UB builds are based on Mach-O, not Carbon. The declare call is different.

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

IIRC, that was for a Double Clickable Canvas, not a listbox. There's also one in the examples by Geoff. Making one for a Listbox cell requires a bit of modification but is entirely feasible.

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?

"InterfaceLib" is for OS9.

Better still is to create a constant that will enter the correct library call based on the platorm.

Remember that UB's are built using the Mach-O framework and that "Carbon Lib" is a PEF call in a Declare.

Another thing you should be aware of is that many Double-Click routines (like Seth's and Geoff's) use the Mouse-Up event that can play havoc when applying it to a Listbox's CellClick event.

Should you wish an example, call me off-list.

Terry


_______________________________________________
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