Author | Topic: tdmultiget1() | |
---|---|---|
Donald R. Keating | tdmultiget1() on Fri, 20 Aug 2010 12:00:55 -0400 Hi Y'all, I'm stumped again and will appreciate your suggestions. My tdmultiget1() has two gets. I want to populate a public array to be used as the xList parameter in the second get based on the value of editbuffer() in the first get. I do this fine using the bValid in first get. The function called by the first get bValid works fine and the array is populated with 552 elements. But, since the array was empty when the tdmultiget1() was called it doesn't activate the lookup features on the second get. Thanks for ideas. >don< | |
Raymond | Re: tdmultiget1() on Fri, 20 Aug 2010 20:21:31 +0200 Hello Don, I am afraid you are facing a problem that cannot be solved the way you do it. TdMultiGet1() uses tdXget() to create the SLE. The handling of the array is based on the array at the time the SLE is created. Any change to the array will not be reflected on the fly. I faced the same problem with a Get for which I tried to set the lookup array based on another SLE content. The only work around, that I see to this problem in tdMultiGet1(), is to replace the array in Xlist by a codeblock where you can popup a tdAchoose(). There might be other solutions but I can't figure out any of them. I didn't try it as I choose another solution in my tdXget() but this solution cannot be used in tdMultiGet1(). Best regards, Raymond Donald R. Keating a exprimé avec précision : > Hi Y'all, > > I'm stumped again and will appreciate your suggestions. > > My tdmultiget1() has two gets. > > I want to populate a public array to be used as the xList parameter in the > second get based on the value of editbuffer() in the first get. I do this > fine using the bValid in first get. > > The function called by the first get bValid works fine and the array is > populated with 552 elements. > > But, since the array was empty when the tdmultiget1() was called it doesn't > activate the lookup features on the second get. > > Thanks for ideas. > > >don< Amicalement, Raymond http://www.mouches.org http://www.cpmn.be | |
Donald R. Keating | Re: tdmultiget1() on Fri, 20 Aug 2010 15:02:56 -0400 Thanks Raymond, Was afraid that was the case. I tried with two tdxgets on a tdstat and had same problem. I'm not tied to the tdmultiget. Will you share your solution using tdxgets? >don< On Fri, 20 Aug 2010 20:21:31 +0200, Raymond wrote: > Hello Don, > > I am afraid you are facing a problem that cannot be solved the way you > do it. > > TdMultiGet1() uses tdXget() to create the SLE. The handling of the > array is based on the array at the time the SLE is created. Any change > to the array will not be reflected on the fly. > > I faced the same problem with a Get for which I tried to set the lookup > array based on another SLE content. > > The only work around, that I see to this problem in tdMultiGet1(), is > to replace the array in Xlist by a codeblock where you can popup a > tdAchoose(). There might be other solutions but I can't figure out any > of them. > > I didn't try it as I choose another solution in my tdXget() but this > solution cannot be used in tdMultiGet1(). > > Best regards, > Raymond > > > > > > > Donald R. Keating a exprimé avec précision : > > Hi Y'all, > > > > I'm stumped again and will appreciate your suggestions. > > > > My tdmultiget1() has two gets. > > > > I want to populate a public array to be used as the xList parameter in the > > second get based on the value of editbuffer() in the first get. I do this > > fine using the bValid in first get. > > > > The function called by the first get bValid works fine and the array is > > populated with 552 elements. > > > > But, since the array was empty when the tdmultiget1() was called it doesn't > > activate the lookup features on the second get. > > > > Thanks for ideas. > > > > >don< | |
Raymond | Re: tdmultiget1() on Fri, 20 Aug 2010 21:46:44 +0200 Hello Don, Well, I simply added a small button looking like [...] at the right of the SLE. When the user clicks it, I open a tdAchoose() based on the newly filled array. When I create the button: tdPshBtn(nLine,53,2,oGb,"...",{||postAppEvent(xbeP_Keyboard,xbeP_User+1,,oDlg)},tdNG) In the keyboard handler: ELSEIF nKey == xbeP_User+1 GetUser(aGets,oDlg,ouser) And then the function: STATIC FUNCTION GetUser(aGets,oDlg,ouser) ... some initialisation ... nInd := tdAchoose(aUsers,10,30,"Select the User",,,.T.,,,"9.Courier New",,oDlg,,; "s",.T.,,{tdDBL,tdPYL},tdPGN) IF nInd > 0 cUser := Alltrim(Right(aUsers[nInd],Len(aUsers[nInd])-19)) ouser:setCaption(cUser) aGets[C_user]:setdata(Left(aUsers[nInd],16)) ENDIF Remark: 1. aUsers is constructed as a single array madde of User id (16 chars) followed by " - " followed by the user's name 2. I think that you can also directly call the function GetUser() in the xList codeblock (as I understand, it will create the button for you). When I made my workaround, I overlooked this feature. HTH, Raymond Donald R. Keating a présenté l'énoncé suivant : > Thanks Raymond, > > Was afraid that was the case. > > I tried with two tdxgets on a tdstat and had same problem. I'm not tied to > the tdmultiget. Will you share your solution using tdxgets? > > >don< > > > On Fri, 20 Aug 2010 20:21:31 +0200, Raymond wrote: > >> Hello Don, >> >> I am afraid you are facing a problem that cannot be solved the way you >> do it. >> >> TdMultiGet1() uses tdXget() to create the SLE. The handling of the >> array is based on the array at the time the SLE is created. Any change >> to the array will not be reflected on the fly. >> >> I faced the same problem with a Get for which I tried to set the lookup >> array based on another SLE content. >> >> The only work around, that I see to this problem in tdMultiGet1(), is >> to replace the array in Xlist by a codeblock where you can popup a >> tdAchoose(). There might be other solutions but I can't figure out any >> of them. >> >> I didn't try it as I choose another solution in my tdXget() but this >> solution cannot be used in tdMultiGet1(). >> >> Best regards, >> Raymond >> >> >> >> >> >> >> Donald R. Keating a exprimé avec précision : >>> Hi Y'all, >>> >>> I'm stumped again and will appreciate your suggestions. >>> >>> My tdmultiget1() has two gets. >>> >>> I want to populate a public array to be used as the xList parameter in the >>> second get based on the value of editbuffer() in the first get. I do this >>> fine using the bValid in first get. >>> >>> The function called by the first get bValid works fine and the array is >>> populated with 552 elements. >>> >>> But, since the array was empty when the tdmultiget1() was called it doesn't >>> activate the lookup features on the second get. >>> >>> Thanks for ideas. >>> >>> >don< Amicalement, Raymond http://www.mouches.org http://www.cpmn.be | |
Donald R. Keating | Re: tdmultiget1() on Sun, 22 Aug 2010 13:54:14 -0400 Raymond, Think I have the tdmultiget1 working like I want. At least it works in my tests. It's in client's hand now, will let you know how it turns out. >don< On Fri, 20 Aug 2010 21:46:44 +0200, Raymond wrote: > Hello Don, > > Well, I simply added a small button looking like [...] at the right of > the SLE. When the user clicks it, I open a tdAchoose() based on the > newly filled array. > > When I create the button: > tdPshBtn(nLine,53,2,oGb,"...",{||postAppEvent(xbeP_Keyboard,xbeP_User+1,,oDlg)},tdNG) > > In the keyboard handler: > ELSEIF nKey == xbeP_User+1 > GetUser(aGets,oDlg,ouser) > > And then the function: > STATIC FUNCTION GetUser(aGets,oDlg,ouser) > > ... some initialisation ... > > nInd := tdAchoose(aUsers,10,30,"Select the User",,,.T.,,,"9.Courier > New",,oDlg,,; > "s",.T.,,{tdDBL,tdPYL},tdPGN) > IF nInd > 0 > cUser := Alltrim(Right(aUsers[nInd],Len(aUsers[nInd])-19)) > ouser:setCaption(cUser) > aGets[C_user]:setdata(Left(aUsers[nInd],16)) > ENDIF > > Remark: > 1. aUsers is constructed as a single array madde of > User id (16 chars) followed by " - " followed by the user's name > > 2. I think that you can also directly call the function GetUser() in > the xList codeblock (as I understand, it will create the button for > you). > When I made my workaround, I overlooked this feature. > > > HTH, > Raymond > > > > Donald R. Keating a présenté l'énoncé suivant : > > Thanks Raymond, > > > > Was afraid that was the case. > > > > I tried with two tdxgets on a tdstat and had same problem. I'm not tied to > > the tdmultiget. Will you share your solution using tdxgets? > > > > >don< > > > > > > On Fri, 20 Aug 2010 20:21:31 +0200, Raymond wrote: > > > >> Hello Don, > >> > >> I am afraid you are facing a problem that cannot be solved the way you > >> do it. > >> > >> TdMultiGet1() uses tdXget() to create the SLE. The handling of the > >> array is based on the array at the time the SLE is created. Any change > >> to the array will not be reflected on the fly. > >> > >> I faced the same problem with a Get for which I tried to set the lookup > >> array based on another SLE content. > >> > >> The only work around, that I see to this problem in tdMultiGet1(), is > >> to replace the array in Xlist by a codeblock where you can popup a > >> tdAchoose(). There might be other solutions but I can't figure out any > >> of them. > >> > >> I didn't try it as I choose another solution in my tdXget() but this > >> solution cannot be used in tdMultiGet1(). > >> > >> Best regards, > >> Raymond > >> > >> > >> > >> > >> > >> > >> Donald R. Keating a exprimé avec précision : > >>> Hi Y'all, > >>> > >>> I'm stumped again and will appreciate your suggestions. > >>> > >>> My tdmultiget1() has two gets. > >>> > >>> I want to populate a public array to be used as the xList parameter in the > >>> second get based on the value of editbuffer() in the first get. I do this > >>> fine using the bValid in first get. > >>> > >>> The function called by the first get bValid works fine and the array is > >>> populated with 552 elements. > >>> > >>> But, since the array was empty when the tdmultiget1() was called it doesn't > >>> activate the lookup features on the second get. > >>> > >>> Thanks for ideas. > >>> > >>> >don< | |
James Loughner | Re: tdmultiget1() on Sat, 21 Aug 2010 12:00:28 -0400 I have not looked at TD for some time but is seems you could populate the required array at the class level. Or maybe pass the array in by reference ie @mypubarray. Jim On 08/20/2010 12:00 PM, Donald R. Keating wrote: > Hi Y'all, > > I'm stumped again and will appreciate your suggestions. > > My tdmultiget1() has two gets. > > I want to populate a public array to be used as the xList parameter in the > second get based on the value of editbuffer() in the first get. I do this > fine using the bValid in first get. > > The function called by the first get bValid works fine and the array is > populated with 552 elements. > > But, since the array was empty when the tdmultiget1() was called it doesn't > activate the lookup features on the second get. > > Thanks for ideas. > > >don< > | |
Donald R. Keating | Re: tdmultiget1() on Sat, 21 Aug 2010 20:27:55 -0400 Thanks Jim, >don< On Sat, 21 Aug 2010 12:00:28 -0400, James Loughner wrote: > I have not looked at TD for some time but is seems you could populate > the required array at the class level. Or maybe pass the array in by > reference ie @mypubarray. > > Jim > > On 08/20/2010 12:00 PM, Donald R. Keating wrote: > > Hi Y'all, > > > > I'm stumped again and will appreciate your suggestions. > > > > My tdmultiget1() has two gets. > > > > I want to populate a public array to be used as the xList parameter in the > > second get based on the value of editbuffer() in the first get. I do this > > fine using the bValid in first get. > > > > The function called by the first get bValid works fine and the array is > > populated with 552 elements. > > > > But, since the array was empty when the tdmultiget1() was called it doesn't > > activate the lookup features on the second get. > > > > Thanks for ideas. > > > > >don< > > | |
Clayton Jones | Re: tdmultiget1() on Fri, 27 Aug 2010 02:21:24 -0400 Hello Don, I finally got my news reader fixed. >I want to populate a public array to be used as the xList parameter in the >second get based on the value of editbuffer() in the first get. I do this >fine using the bValid in first get. > >The function called by the first get bValid works fine and the array is >populated with 552 elements. > >But, since the array was empty when the tdmultiget1() was called it doesn't >activate the lookup features on the second get. Try this: Create the 2nd Get using a dummy array (something as simple as this {"1"} will do). This will activate it's picklist feature. Then use a bWhen codeblock to change the array on the fly just before giving focus to the Get. Have the codeblock call a function which contains the logic to load the array (see example below), then replace the dummy array using the :SetList() method. The Help topic "Using Picklists With Get Objects" shows a couple of ways to do this. That should do it. Example: bWhen := {|o| WhenFunc(o) } In tdMultiGet1() the 1st Get's value can be determined via the 2nd Get object in the bWhen function (see the MultiGet docs for bWhen). Something like this ought to work (this approach avoids having to use a Public var for the array): ------------------------------------------------------- FUNCTION WhenFunc(oGet) LOCAL aArray,cBuf1 cBuf1 := oGet:oParentDlg:cargo[1]:editbuffer() IF cBuf1 == "whatever" aArray := {"a","b","c"} ELSE aArray := {"x","y","z"} ENDIF oGet:setList(aArray) RETURN .T. ------------------------------------------------------- BTW, I've been working on a big project last few months and we're using tdMultiGet1() a lot. It's been a huge time saver. Regards, Clayton Clayton Jones www.cjcom.net Top-Down Library for Xbase++ X-DBU Database Utility X-MEMO Memo Field Replacement | |
Don Keating | Re: tdmultiget1() on Mon, 30 Aug 2010 11:40:27 -0400 Thanks Clayton, I was close but, no cigar. I tried to do it with the valid block in the first get and think it would've probably worked if I'd used o:setlist(). >don< On Fri, 27 Aug 2010 02:21:24 -0400, Clayton Jones wrote: > Hello Don, > > I finally got my news reader fixed. > > >I want to populate a public array to be used as the xList parameter in the > >second get based on the value of editbuffer() in the first get. I do this > >fine using the bValid in first get. > > > >The function called by the first get bValid works fine and the array is > >populated with 552 elements. > > > >But, since the array was empty when the tdmultiget1() was called it doesn't > >activate the lookup features on the second get. > > Try this: Create the 2nd Get using a dummy array (something as simple > as this {"1"} will do). This will activate it's picklist feature. > Then use a bWhen codeblock to change the array on the fly just before > giving focus to the Get. Have the codeblock call a function which > contains the logic to load the array (see example below), then replace > the dummy array using the :SetList() method. The Help topic "Using > Picklists With Get Objects" shows a couple of ways to do this. That > should do it. > > Example: > > bWhen := {|o| WhenFunc(o) } > > In tdMultiGet1() the 1st Get's value can be determined via the 2nd Get > object in the bWhen function (see the MultiGet docs for bWhen). > Something like this ought to work (this approach avoids having to use > a Public var for the array): > ------------------------------------------------------- > FUNCTION WhenFunc(oGet) > LOCAL aArray,cBuf1 > > cBuf1 := oGet:oParentDlg:cargo[1]:editbuffer() > > IF cBuf1 == "whatever" > aArray := {"a","b","c"} > ELSE > aArray := {"x","y","z"} > ENDIF > > oGet:setList(aArray) > > RETURN .T. > ------------------------------------------------------- > > > > BTW, I've been working on a big project last few months and we're > using tdMultiGet1() a lot. It's been a huge time saver. > > > Regards, > Clayton > > Clayton Jones www.cjcom.net > Top-Down Library for Xbase++ > X-DBU Database Utility > X-MEMO Memo Field Replacement |