The following should work around the problem.

Declare Function SetUserFocusWindow Lib "CarbonLib" (inWindow as Integer) as Integer
  if w <> NIL then
      err = SetUserFocusWindow(w.Handle)
    else
      err = SetUserFocusWindow(-1)
    end if

Charles Yeomans

On Apr 10, 2006, at 4:17 PM, Peter Truskier wrote:

Hah! Joe says it's my code, and Jonathan says it's definitely a bug...

The only thing that made me think I could do it was that I *HAD* done it with n version of RB where n is a pretty large number. I can see that Joe is right in that commenting either of the two declarations allows the code to compile, but using the "Alias" clause still results in the same error with neither commented out.

I will file a report, but in the meantime, any other workaround would be welcomed.

Thanks,

Peter

On Apr 10, 2006, at 12:48 PM, Joseph J. Strout wrote:

At 12:40 PM -0700 4/10/06, Peter Truskier wrote:

The following snippet compiles and works correctly in RB 5.X - 2006r1, but results in a compiler error - "this method does not exist" - on "err = SetUserFocusWindow(-1)" (i.e., in the "else" code):

Why do you think you can declare two functions with the same name? It's not in a #if block, and the scope of a declare statement is not restricted to the code block it's in, unlike a Dim statement, at least AFAIK.

If you comment out the first declare, then the second one works just fine, so I'd call it a bit of a fluke that it ever worked at all. To do what you're trying to do, you'll have to give one of the declares a different name (via the Alias clause).

_______________________________________________
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