| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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 |
|
#2
| |||
| |||
| 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 |
|
#3
| |||
| |||
| 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. |
|
#4
| |||
| |||
| 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 |
|
#5
| |||
| |||
| 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 |
|
#6
| |||
| |||
| "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. |
|
#7
| |||
| |||
| 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. > |
|
#8
| |||
| |||
| 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() ? |
|
#9
| |||
| |||
| 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() ? |
|
#10
| |||
| |||
| 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. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.