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
Combobox on multidimensional array
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42520
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Re: Combobox on multidimensional array
Marco,
Code: Select all | Expand
#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
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Re: Combobox on multidimensional array
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> ;
[ <items: PROMPTS, ITEMS> <aItems> ] ;
[ ID <nId> ] ;
[ <dlg:OF,WINDOW,DIALOG> <oWnd> ] ;
[ <help:HELPID, HELP ID> <nHelpId> ] ;
[ ON CHANGE <uChange> ] ;
[ VALID <uValid> ] ;
[ <color: COLOR,COLORS> <nClrText> [,<nClrBack>] ] ;
[ <update: UPDATE> ] ;
[ MESSAGE <cMsg> ] ;
[ WHEN <uWhen> ] ;
[ BITMAPS <acBitmaps> ] ;
[ ON DRAWITEM <uBmpSelect> ] ;
[ STYLE <nStyle> ] ;
[ <pict: PICT, PICTURE> <cPicture> ];
[ ON EDIT CHANGE <uEChange> ] ;
=> ;
[ <oCbx> := ] TComboBox():ReDefine( <nId>, bSETGET(<cVar>),;
ArrTranspose(<aItems>)[2], <oWnd>, <nHelpId>, <{uValid}>, [{|Self|<uChange>}],;
<nClrText>, <nClrBack>, <cMsg>, <.update.>, <{uWhen}>,;
<acBitmaps>, [{|nItem|<uBmpSelect>}], <nStyle>, <cPicture>,;
[<{uEChange}>] )
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> ;
[ <items: PROMPTS, ITEMS> <aItems> ] ;
[ ID <nId> ] ;
[ <dlg:OF,WINDOW,DIALOG> <oWnd> ] ;
[ <help:HELPID, HELP ID> <nHelpId> ] ;
[ ON CHANGE <uChange> ] ;
[ VALID <uValid> ] ;
[ <color: COLOR,COLORS> <nClrText> [,<nClrBack>] ] ;
[ <update: UPDATE> ] ;
[ MESSAGE <cMsg> ] ;
[ WHEN <uWhen> ] ;
[ BITMAPS <acBitmaps> ] ;
[ ON DRAWITEM <uBmpSelect> ] ;
[ STYLE <nStyle> ] ;
[ <pict: PICT, PICTURE> <cPicture> ];
[ ON EDIT CHANGE <uEChange> ] ;
=> ;
[ <oCbx> := ] TComboBox():ReDefine( <nId>, bSETGET(<cVar>),;
ArrTranspose(<aItems>)[2], <oWnd>, <nHelpId>, <{uValid}>, [{|Self|<uChange>}],;
<nClrText>, <nClrBack>, <cMsg>, <.update.>, <{uWhen}>,;
<acBitmaps>, [{|nItem|<uBmpSelect>}], <nStyle>, <cPicture>,;
[<{uEChange}>] )
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
- Antonio Linares
- Site Admin
- Posts: 42520
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Re: Combobox on multidimensional array
Great !! Thank you Antonio.
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
Re: Combobox on multidimensional array
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
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