XBROWSE; EDIT_GET_LISTBOX

XBROWSE; EDIT_GET_LISTBOX

Postby byte-one » Thu Oct 17, 2013 9:44 am

Can i change the ::aEditListTxt and ::aEditListBound at runtime and show this new contents in the listbox?
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: XBROWSE; EDIT_GET_LISTBOX

Postby nageswaragunupudi » Thu Oct 17, 2013 10:40 am

I do it often for EDIT_LISTBOX.
It should work for EDIT_GET_LISTBOX also. If it does not work, please let us know.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBROWSE; EDIT_GET_LISTBOX

Postby Ariel » Wed May 07, 2014 9:59 am

Nageswaragunupudi,

And as do you it do ???

Regards.
Ariel
 
Posts: 374
Joined: Wed Nov 29, 2006 1:51 pm
Location: Rosario - Argentina

Re: XBROWSE; EDIT_GET_LISTBOX

Postby samtinu » Sat Jul 11, 2015 10:36 am

nageswaragunupudi wrote:I do it often for EDIT_LISTBOX.
It should work for EDIT_GET_LISTBOX also. If it does not work, please let us know.



Could you please give me the solution to set multidimensional array in Xbrowse EDIT_LISTBOX on run time . Single dimensional array is working fine on run time . If i set multidimensional array to aEditListTxt while define xbrowse it is working smoothly , but unable to set aEditListTxt array values on run time .

Regards
Tinu
samtinu
 
Posts: 4
Joined: Mon Apr 23, 2012 7:23 am

Re: XBROWSE; EDIT_GET_LISTBOX

Postby nageswaragunupudi » Sat Jul 11, 2015 11:28 pm

If you want to assign at runtime:

Code: Select all  Expand view
oCol:aEditListTxt    := ArrTranspose( aNewArray )[ 2 ]
oCol:aEditListBound  := ArrTranspose( aNewArray )[ 1 ]
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBROWSE; EDIT_GET_LISTBOX

Postby samtinu » Mon Jul 13, 2015 4:54 am

nageswaragunupudi wrote:If you want to assign at runtime:

Code: Select all  Expand view
oCol:aEditListTxt    := ArrTranspose( aNewArray )[ 2 ]
oCol:aEditListBound  := ArrTranspose( aNewArray )[ 1 ]


Thanks for your reply ,

I had already tried this solution, unfortunately the result is not as expected. The aEditListText contents are displayed properly on the xbrowse inside the Combo box for selection, but once I choose the item from the Combo, xbrowse is displaying the ID instead of the aEditListText's value on the xbrowse.

ie my new array contains EmployeeID and EmplyeeName, if I try to select data from the Combo, the list is showing the Employee Name (as expected), but once I choose the Employee name, xbrowse displays the Employee ID on the xbrowse column.

This problem occurs only if we try to change the array at run time ie after the CreateFromCode() has been called

Regards
Tinu
samtinu
 
Posts: 4
Joined: Mon Apr 23, 2012 7:23 am

Re: XBROWSE; EDIT_GET_LISTBOX

Postby nageswaragunupudi » Wed Jul 15, 2015 7:00 pm

I checked and this is working for me. Please recheck and ensure that you assigned the second column to aEditListTxt and first column to aEditListBound. If you still have problem, please try to prepare a self-contained sample which we can build and test at our end.

From version 15.06 it is enough if you assign new multi-dim array to aEditListTxt at any time during runtime also. You need not do anything else.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBROWSE; EDIT_GET_LISTBOX

Postby samtinu » Mon Jul 20, 2015 6:24 am

nageswaragunupudi wrote:I checked and this is working for me. Please recheck and ensure that you assigned the second column to aEditListTxt and first column to aEditListBound. If you still have problem, please try to prepare a self-contained sample which we can build and test at our end.

From version 15.06 it is enough if you assign new multi-dim array to aEditListTxt at any time during runtime also. You need not do anything else.



Thanks for your support

Here is a sample that reproduce the said problem. I am assigning values to aEditListTxt, aEditListBound at run time. When you run the code, please click the button available at the bottom of the xbrowse to set values to aEditListTxt, aEditListBound at run time. Please note that the displays the country names in the combo box, but once we select the item from the Combo box, the country code is displayed on the xbrowse column instead of the country name.
Code: Select all  Expand view
#Include "FiveWin.ch"
#include "Xbrowse.ch"
 
*--------------------------------*
Function Test()
*--------------------------------*
Local oDlg,oBrw,aAlias:={{"","",""}}

   DEFINE DIALOG oDlg SIZE 440,220 PIXEL  TITLE 'XBrowse '
   
      @  10, 10 XBROWSE oBrw  OF oDlg ;
         COLUMNS 1,2,3;
         ALIAS aAlias AUTOCOLS SIZE 200,70 PIXEL
         
         WITH OBJECT oBrw
               :aCols[1]:nEditType :=  EDIT_LISTBOX  
               :aCols[1]:aEditListTxt := {}
               :aCols[1]:aEditListBound := {}
               :CreateFromCode()
     END
         
    @ 5, 10 BUTTON "Set List BOX" SIZE  70, 10 ACTION Test1(oDlg,oBrw)
   
   ACTIVATE DIALOG oDlg
 
Return Nil
 
*--------------------------------*
Function Test1(oDlg,oBrw)
*--------------------------------*
Local aList:={{1,"Canada"},;
                    {2,"US"},;
                    {3,"Australia"}}

    oBrw:aCols[1]:nEditType :=  EDIT_LISTBOX
    oBrw:aCols[1]:aEditListBound  := ArrTranspose( aList)[ 1 ]
    oBrw:aCols[1]:aEditListTxt    := ArrTranspose( aList )[ 2 ]
    oBrw:Refresh()

Return Nil


The following code works fine ie while defining the xbrowse, if I assign a blank array to aEditListTxt, aEditListBound ie {""}, then everything is working as expected ie after selecting the item from the combobox the country name is displayed in the xbrowse column
Code: Select all  Expand view
#Include "FiveWin.ch"
#include "Xbrowse.ch"

 
*--------------------------------*
Function Test()
*--------------------------------*

Local oDlg,oBrw,aAlias:={{"","",""}}

   DEFINE DIALOG oDlg SIZE 440,220 PIXEL  TITLE 'XBrowse '
   
      @  10, 10 XBROWSE oBrw  OF oDlg ;
         COLUMNS 1,2,3;
         ALIAS aAlias AUTOCOLS SIZE 200,70 PIXEL
         
        WITH OBJECT oBrw
           :aCols[1]:nEditType :=  EDIT_LISTBOX  /*IF i first assign aEditListTxt,aEditListBound blank array it will work fine */
           :aCols[1]:aEditListTxt := {""}
           :aCols[1]:aEditListBound := {""}
           :CreateFromCode()
        END
    
    @ 5, 10 BUTTON "Set List BOX" SIZE  70, 10 ACTION Test1(oDlg,oBrw)
   
   ACTIVATE DIALOG oDlg
   
Return Nil
 
*--------------------------------*
Function Test1(oDlg,oBrw)
*--------------------------------*

Local aList:={{1,"Canada"},;
                    {2,"US"},;
                    {3,"Australia"}}

    oBrw:aCols[1]:nEditType :=  EDIT_LISTBOX
    oBrw:aCols[1]:aEditListBound  := ArrTranspose( aList)[ 1 ]
    oBrw:aCols[1]:aEditListTxt    := ArrTranspose( aList )[ 2 ]
    oBrw:Refresh()

Return Nil


Regards
Tinu
samtinu
 
Posts: 4
Joined: Mon Apr 23, 2012 7:23 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Otto and 41 guests