FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Combobox and multiarray
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Combobox and multiarray
Posted: Sun Jan 20, 2013 03:22 PM

Hi all,
another question about combobox.
Is there a way to use a combobox to display only the second element of a multiarray ?

For example, I have a multi array like this:

aItems:={}
aadd(aItems,{"01","Marc"})
aadd(aItems,{"02","Frank"})
aadd(aItems,{"03","Paul"})

and I would like to display into the combo just the second element, so "Marc","Frank","Paul".
At the moment I solved making a new class but I would like to make this using the standard combobox class if possibile.

Any ideas ? Thanks in advance.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Combobox and multiarray
Posted: Sun Jan 20, 2013 03:38 PM

@ r, c COMBOBOX oCbx ........ ITEMS ArrTranspose( aItems )[ 2 ] .......

Regards



G. N. Rao.

Hyderabad, India
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Combobox and multiarray
Posted: Sun Jan 20, 2013 05:20 PM

Hi nageswaragunupudi,
thanks for the suggest. It runs well used as command line, but I'm unable to create a command "COMBOLIST" that automatically use this function with multidimensional array taking always the 2nd element.

Where I'm wrong ?

xcommand REDEFINE COMBOLIST [ <oCbx> VAR ] <cVar> ;

         [ &lt;items: PROMPTS, ITEMS&gt; &lt;aItems&gt; ] ;
         [ ID &lt;nId&gt; ] ;
         [ &lt;dlg:OF,WINDOW,DIALOG&gt; &lt;oWnd&gt; ] ;
         [ &lt;help:HELPID, HELP ID&gt; &lt;nHelpId&gt; ] ;
         [ ON CHANGE &lt;uChange&gt; ] ;
         [ VALID   &lt;uValid&gt; ] ;
         [ &lt;color: COLOR,COLORS&gt; &lt;nClrText&gt; [,&lt;nClrBack&gt;] ] ;
         [ &lt;update: UPDATE&gt; ] ;
         [ MESSAGE &lt;cMsg&gt; ] ;
         [ WHEN &lt;uWhen&gt; ] ;
         [ BITMAPS &lt;acBitmaps&gt; ] ;
         [ ON DRAWITEM &lt;uBmpSelect&gt; ] ;
         [ STYLE &lt;nStyle&gt; ] ;
         [ &lt;pict: PICT, PICTURE&gt; &lt;cPicture&gt; ];
         [ ON EDIT CHANGE &lt;uEChange&gt; ] ;
   =&gt; ;
      [ &lt;oCbx&gt; := ] TComboBox():ReDefine( &lt;nId&gt;, bSETGET(&lt;cVar&gt;),;
         ArrTranspose(&lt;aItems&gt;)[2], &lt;oWnd&gt;, &lt;nHelpId&gt;, &lt;{uValid}&gt;, [{|Self|&lt;uChange&gt;}],;
         &lt;nClrText&gt;, &lt;nClrBack&gt;, &lt;cMsg&gt;, &lt;.update.&gt;, &lt;{uWhen}&gt;,;
         &lt;acBitmaps&gt;, [{|nItem|&lt;uBmpSelect&gt;}], &lt;nStyle&gt;, &lt;cPicture&gt;,;
         [&lt;{uEChange}&gt;] )

Thanks in advance

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Combobox and multiarray
Posted: Sun Jan 20, 2013 10:55 PM

ArrTranspose(<aItems>)[2]

Regards



G. N. Rao.

Hyderabad, India
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Combobox and multiarray
Posted: Mon Jan 21, 2013 08:32 AM

Thank you.

Best Regards,



Marco Turco

SOFTWARE XP LLP

Continue the discussion