FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Combobox on multidimensional array
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Combobox on multidimensional array
Posted: Tue Sep 08, 2015 10:57 AM

Hi all,
I have a multidimensional array like:

aArray:=array(0,2)
aadd(1,"Marc")
aadd(2,"Luca")
aadd(3,"Jannette")
aadd(4,"Francis")

and I would make a combobox with only the second element list (the names).

Is there a quick way to make this directly into the REDEFINE COMBOBOX command line ?

Thank you in advance

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Combobox on multidimensional array
Posted: Tue Sep 08, 2015 05:47 PM
Marco,

Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   local aArray := {}
   local oDlg, cName := "Marc"

   AAdd( aArray, { 1, "Marc" } )
   AAdd( aArray, { 2, "Luca" } )
   AAdd( aArray, { 3, "Jannette" } )
   AAdd( aArray, { 4, "Francis" } )

   DEFINE DIALOG oDlg

   @ 1, 1 COMBOBOX cName ITEMS ArrTranspose( aArray )[ 2 ]

   ACTIVATE DIALOG oDlg CENTERED

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Combobox on multidimensional array
Posted: Wed Sep 09, 2015 03:43 PM

Hi Antonio,
it runs. Thank you.

I have just a problem trying to use the ArrTranspose() into the command syntax,
essentially I have to replace the <aItems> with ArrTranspose(<aItems>)[2] but it doesn't runs, sure for a syntax problem. Any ideas ?
Thank you.

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;] )
Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Combobox on multidimensional array
Posted: Wed Sep 09, 2015 05:42 PM

Marco,

Please try this:

ArrTranspose(<aItems>)[2]

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Combobox on multidimensional array
Posted: Wed Sep 09, 2015 07:55 PM

Great !! Thank you Antonio.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Combobox on multidimensional array
Posted: Wed Sep 09, 2015 08:09 PM

Marco
I think the solution is:

viewtopic.php?f=3t=25496start=0hilit=arrtranspose


Sorry,
It's a joke

&&&:D:D:D

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion