refresh a menu displayed by aChoice()

This is a discussion on refresh a menu displayed by aChoice() within the xharbour forums in Programming Languages category; Hello, I've a problem with the aChoice() function. The menu displayed is not refreshed when the underlying array changes. Here is an example : procedure Main() private aTable1, aTable2 aTable1 = {"a", "b", "c"} aTable2 = {.T., .T., .T.} achoice(1,0,19,62,aTable1, aTable2, "afunction") function afunction() if( lastkey()=-5) // F6 ains(aTable1, 2, "fdkfldm", .T.) ains(aTable2, 2, .T., .T.) endif return 2 When F6 is pressed, an item is added but nothing change to the screen. Is it a bug or am I missing something ? Regards, mathmax...

Go Back   Application Development Forum > Programming Languages > xharbour

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-02-2008, 12:10 PM
maximeandrighetto@gmail.com
Guest
 
Default refresh a menu displayed by aChoice()

Hello,

I've a problem with the aChoice() function. The menu displayed is not
refreshed when the underlying array changes.

Here is an example :

procedure Main()
private aTable1, aTable2

aTable1 = {"a", "b", "c"}
aTable2 = {.T., .T., .T.}

achoice(1,0,19,62,aTable1, aTable2, "afunction")

function afunction()
if( lastkey()=-5) // F6
ains(aTable1, 2, "fdkfldm", .T.)
ains(aTable2, 2, .T., .T.)
endif
return 2

When F6 is pressed, an item is added but nothing change to the screen.

Is it a bug or am I missing something ?

Regards,

mathmax
Reply With Quote
  #2  
Old 09-02-2008, 08:42 PM
N:dlzc D:aol T:com \(dlzc\)
Guest
 
Default Re: refresh a menu displayed by aChoice()

Dear maximeandrighetto:

<maximeandrighetto@gmail.com> wrote in message
news:9fd9cf27-34dc-4732-bd8a-1e1178300b2b@k7g2000hsd.googlegroups.com...
> Hello,
>
> I've a problem with the aChoice() function. The menu
> displayed is not refreshed when the underlying array
> changes.
>
> Here is an example :
>
> procedure Main()
> private aTable1, aTable2
>
> aTable1 = {"a", "b", "c"}
> aTable2 = {.T., .T., .T.}
>
> achoice(1,0,19,62,aTable1, aTable2, "afunction")
>
> function afunction()
> if( lastkey()=-5) // F6
> ains(aTable1, 2, "fdkfldm", .T.)
> ains(aTable2, 2, .T., .T.)
> endif
> return 2
>
> When F6 is pressed, an item is added but nothing
> change to the screen.
>
> Is it a bug or am I missing something ?


Neither Clipper nor (x)Harbour has a "refresh" return value from
the UDF.

I suggest you wrap your achoice function call into your own
wrapper function, and use code to trigger a new call to achoice
after you adjust the array (if you need to). Better still, send
the information to be added / deleted to the "supervisory"
function, rather than risking breaking achoice() with potential
invalid memory pointers.

David A. Smith


Reply With Quote
  #3  
Old 09-02-2008, 10:33 PM
maximeandrighetto@gmail.com
Guest
 
Default Re: refresh a menu displayed by aChoice()

On Sep 3, 2:42*am, "N:dlzc D:aol T:com \(dlzc\)" <dl...@cox.net>
wrote:
> Dear maximeandrighetto:
>
> <maximeandrighe...@gmail.com> wrote in message
>
> news:9fd9cf27-34dc-4732-bd8a-1e1178300b2b@k7g2000hsd.googlegroups.com...
>
>
>
> > Hello,

>
> > I've a problem with the aChoice() function. The menu
> > displayed is not refreshed when the underlying array
> > changes.

>
> > Here is an example :

>
> > procedure Main()
> > private aTable1, aTable2

>
> > aTable1 = {"a", "b", "c"}
> > aTable2 = {.T., .T., .T.}

>
> > achoice(1,0,19,62,aTable1, aTable2, "afunction")

>
> > function afunction()
> > if( lastkey()=-5) * *// F6
> > *ains(aTable1, 2, "fdkfldm", .T.)
> > *ains(aTable2, 2, .T., .T.)
> > endif
> > return 2

>
> > When F6 is pressed, an item is added but nothing
> > change to the screen.

>
> > Is it a bug or am I missing something ?

>
> Neither Clipper nor (x)Harbour has a "refresh" return value from
> the UDF.
>
> I suggest you wrap your achoice function call into your own
> wrapper function, and use code to trigger a new call to achoice
> after you adjust the array (if you need to). *Better still, send
> the information to be added / deleted to the "supervisory"
> function, rather than risking breaking achoice() with potential
> invalid memory pointers.
>
> David A. Smith


The above code work with clipper 5.2. The item added by afunction() is
immediately shown to the UDF.
Reply With Quote
  #4  
Old 09-02-2008, 11:00 PM
N:dlzc D:aol T:com \(dlzc\)
Guest
 
Default Re: refresh a menu displayed by aChoice()

Dear maximeandrighetto:

<maximeandrighetto@gmail.com> wrote in message
news:7f470ced-3d9b-4d9e-b95a-c513c9c51c14@z66g2000hsc.googlegroups.com...
On Sep 3, 2:42 am, "N:dlzc D:aol T:com \(dlzc\)" <dl...@cox.net>
wrote:
> news:9fd9cf27-34dc-4732-bd8a-1e1178300b2b@k7g2000hsd.googlegroups.com...
>> > I've a problem with the aChoice() function. The menu
>> > displayed is not refreshed when the underlying array
>> > changes.

>
>> > Here is an example :

>
>> > procedure Main()
>> > private aTable1, aTable2

>
>> > aTable1 = {"a", "b", "c"}
>> > aTable2 = {.T., .T., .T.}

>
>> > achoice(1,0,19,62,aTable1, aTable2, "afunction")

>
>> > function afunction()
>> > if( lastkey()=-5) // F6
>> > ains(aTable1, 2, "fdkfldm", .T.)
>> > ains(aTable2, 2, .T., .T.)
>> > endif
>> > return 2

>
>> > When F6 is pressed, an item is added but
>> > nothing change to the screen.

>
>> > Is it a bug or am I missing something ?

>
>> Neither Clipper nor (x)Harbour has a "refresh"
>> return value from the UDF.

>
>> I suggest you wrap your achoice function
>> call into your own wrapper function, and
>> use code to trigger a new call to achoice
>> after you adjust the array (if you need to).
>> Better still, send the information to be added /
>> deleted to the "supervisory" function, rather
>> than risking breaking achoice() with potential
>> invalid memory pointers.


> The above code work with clipper 5.2.


No, it does not. Pressing F6 apparently does nothing, then on
any navigation key, it fails.
"ACHOICE (0) Unrecoverable error 660: Incorrect value type"

> The item added by afunction() is immediately
> shown to the UDF.


I used 5.2e. I have no idea what libraries or third party
"patches" you are using, but plain Clipper 5.2e (and probably
5.3) does not like your code.

So now you know what you are doing wrong.

David A. Smith


Reply With Quote
  #5  
Old 09-02-2008, 11:53 PM
maximeandrighetto@gmail.com
Guest
 
Default Re: refresh a menu displayed by aChoice()

I don't use any patch. Just Clipper 5.2e. Of course you have to change
ains() which cannot be called with four parameters in Clipper.
Try this code, it should work :

private aTable1, aTable2

aTable1 = {"a", "b", "c"}
aTable2 = {.T., .T., .T.}

achoice(1,0,19,62,aTable1, aTable2, "afunction")

function afunction()
ntouche = lastkey()

do case
case ntouche=-5 // F6
aadd(aTable1,)
ains(aTable1, 2)
aTable1[2] = "fdkfldm"
aadd(aTable2,)
ains(aTable2, 2)
aTable2[2] = .T.
endcase
return 2
Reply With Quote
  #6  
Old 09-03-2008, 07:54 AM
bill robertson
Guest
 
Default Re: refresh a menu displayed by aChoice()

"N:dlzc D:aol T:com (dlzc)" <dlzc1@cox.net> wrote in message
news:f5nvk.23147$_s1.12456@newsfe07.iad...
> Dear maximeandrighetto:
>
> <maximeandrighetto@gmail.com> wrote in message
> news:7f470ced-3d9b-4d9e-b95a-c513c9c51c14@z66g2000hsc.googlegroups.com...
> On Sep 3, 2:42 am, "N:dlzc D:aol T:com \(dlzc\)" <dl...@cox.net>
> wrote:
> shown to the UDF.
>
> I used 5.2e. I have no idea what libraries or third party "patches" you
> are using, but plain Clipper 5.2e (and probably 5.3) does not like your
> code.
>
> So now you know what you are doing wrong.
>
> David A. Smith

Hi David,

His code in Clipper v5.2e and Clipper v5.3b worked OK for me but not in
xHarbour.


Reply With Quote
  #7  
Old 09-03-2008, 07:58 AM
bill robertson
Guest
 
Default Re: refresh a menu displayed by aChoice()

Hi All,

Further tests shows maximeandrighetto's program works OK in Harbour as well.
It appears to be a xHarbour bug in aChoice().

"bill robertson" <marydick2007@comcast.net> wrote in message
news:8dednSIFzeuO5iPVnZ2dnUVZ_gednZ2d@comcast.com. ..
> "N:dlzc D:aol T:com (dlzc)" <dlzc1@cox.net> wrote in message
> news:f5nvk.23147$_s1.12456@newsfe07.iad...
>> Dear maximeandrighetto:
>>
>> <maximeandrighetto@gmail.com> wrote in message
>> news:7f470ced-3d9b-4d9e-b95a-c513c9c51c14@z66g2000hsc.googlegroups.com...
>> On Sep 3, 2:42 am, "N:dlzc D:aol T:com \(dlzc\)" <dl...@cox.net>
>> wrote:
>> shown to the UDF.
>>
>> I used 5.2e. I have no idea what libraries or third party "patches" you
>> are using, but plain Clipper 5.2e (and probably 5.3) does not like your
>> code.
>>
>> So now you know what you are doing wrong.
>>
>> David A. Smith

> Hi David,
>
> His code in Clipper v5.2e and Clipper v5.3b worked OK for me but not in
> xHarbour.
>



Reply With Quote
  #8  
Old 09-03-2008, 11:48 AM
maximeandrighetto@gmail.com
Guest
 
Default Re: refresh a menu displayed by aChoice()

Do you think it will be corrected in the next release ?
Can I use the harbour function with the xHarbour compiler ? Where can
I find the source code of harbour achoice() ?
Reply With Quote
  #9  
Old 09-03-2008, 11:54 AM
modalsist@yahoo.com.br
Guest
 
Default Re: refresh a menu displayed by aChoice()

Should be fixed after ChangeLog,v 1.6208 2008/09/03

regards,
Eduardo

On 3 set, 12:48, maximeandrighe...@gmail.com wrote:
> Do you think it will be corrected in the next release ?
> Can I use the harbour function with the xHarbour compiler ? Where can
> I find the source code of harbour achoice() ?


Reply With Quote
  #10  
Old 09-03-2008, 03:30 PM
bill robertson
Guest
 
Default Re: refresh a menu displayed by aChoice()

Hi maximeandrighetto,

<maximeandrighetto@gmail.com> wrote in message
news:f67a6991-f493-4ff5-a6e4-dd2738b4577a@e53g2000hsa.googlegroups.com...
> Do you think it will be corrected in the next release ?
> Can I use the harbour function with the xHarbour compiler ? Where can
> I find the source code of harbour achoice() ?


Probably will be fixed very soon. The compilers while similar are not binary
compatible. It wouldn't be wise to try and mix and match.


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 09:52 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.