Alaska Software Inc. - Achoice
Username: Password:
AuthorTopic: Achoice
Hans =?ISO-8859-1?B?Qvh0a2Vy?=Achoice
on Wed, 19 Sep 2007 11:41:50 +0200
Hi.


I have a little problem. It seems to me, that there is a difference between
Clipper 5.52s Achoice and  Xbase++ ver. 1.90.331 if a userfunction is used
in both cases.

When calling the Clipper Achoice the userfunction is not called before I had
made a keystroke, but in the Xbasse++  the userfunction is called
imediately. 

Is there a bug in Xbase++ or what do I have to do so these two functions
acts in the same way

Best regards,
Hans Btker

Mvh. Hans Btker
Regan Cawkwell Re: Achoice
on Wed, 19 Sep 2007 12:54:30 +0100
Hans Bøtker wrote:
> I have a little problem. It seems to me, that there is a difference between
> Clipper 5.52s Achoice and  Xbase++ ver. 1.90.331 if a userfunction is used
> in both cases.
> 
> When calling the Clipper Achoice the userfunction is not called before I had
> made a keystroke, but in the Xbasse++  the userfunction is called
> imediately. 
> 
> Is there a bug in Xbase++ or what do I have to do so these two functions
> acts in the same way

One thing you may have to remember is that Xbase++ apps, just like all 
windows apps, are event driven in some way, shape or form.

Events are polled continuously, which could be why the user function is 
constantly being called.

So it really depends on what your user function actually does...

If you tell us someone here might be able to tell you how to get that to 
work in the way you want...

Regan Cawkwell
Company  : Real Business Applications Ltd
Title    : Technical Support
Websites : www.rbauk.com
Email    : regan@rbauk.com
------------------------------------------------------
Hans =?ISO-8859-1?B?Qvh0a2Vy?=Svar: Re: Achoice
on Thu, 20 Sep 2007 09:18:31 +0200
Hello Regan.

In the application we do something like this

Setkey(K_F9, {|| MyFunction() })


Function MyFunction()
Local nChoice
Local lMore := .t.

While lMore
    NChoice := achoice(3,48,6,77,{"1) Call1",  "2) Call2", "3) Call3", 4)
Exit},"","UsMy",nValg,1)
    If nChoice = 4
        LMore := .f.
    Endif
Enddo

Return(nil)


Function UsMy(Mode, Number, Row)
Local nValue = AC_CONT
Local Key := LastKey()

if Mode = AC_EXCEPT
  do case
      case key = K_F9
         Alert(This should not happen imediately)
         nValue := 4
   endcase
endif

Return nValue


When we press F9 the function MyFunction is called.
In Clipper the userfunction usMy is not executet unless any key is pressed.
In the Xbase++ usMy is called imediately and then key is set to F9 and the
Alert is pupping up.
It looks to me that the keypress F9 is not removed from the buffer, so the
apllication think the the F9 is pressed twice in a row.

Best regards
Hans Btker

Mvh. Hans Btker

>>> Regan Cawkwell<regan@rbauk.com> 19-09-2007 13:54 >>>
Hans Btker wrote:
> I have a little problem. It seems to me, that there is a difference
between
> Clipper 5.52s Achoice and  Xbase++ ver. 1.90.331 if a userfunction is
used
> in both cases.
> 
> When calling the Clipper Achoice the userfunction is not called before I
had
> made a keystroke, but in the Xbasse++  the userfunction is called
> imediately. 
> 
> Is there a bug in Xbase++ or what do I have to do so these two functions
> acts in the same way

One thing you may have to remember is that Xbase++ apps, just like all 
windows apps, are event driven in some way, shape or form.

Events are polled continuously, which could be why the user function is 
constantly being called.

So it really depends on what your user function actually does...

If you tell us someone here might be able to tell you how to get that to 
work in the way you want...

Regan Cawkwell
Company  : Real Business Applications Ltd
Title    : Technical Support
Websites : www.rbauk.com 
Email    : regan@rbauk.com 
------------------------------------------------------
Rodd Graham Re: Achoice
on Wed, 19 Sep 2007 14:39:23 +0000
Hello Hans,

> I have a little problem. It seems to me, that there is a difference
> between Clipper 5.52s Achoice and  Xbase++ ver. 1.90.331 if a
> userfunction is used in both cases.
> 
> When calling the Clipper Achoice the userfunction is not called before
> I had made a keystroke, but in the Xbasse++  the userfunction is
> called imediately.
> 
> Is there a bug in Xbase++ or what do I have to do so these two
> functions acts in the same way

What parameters is the achoice user function receiving?  Are you sure it 
is not just the AC_IDLE call?

Regards,

Rodd Graham, Consultant
Graham Automation Systems, LLC