Página 1 de 1

ComboBox - 2 dimensional Array

Publicado: Jue Jun 16, 2005 4:39 am
por Mike Draper
I have several tables with a code and a description.
for Example:
ADM Admitted
TRN Transferred
DIS Discharged
I want a combo box where the user can enter DIS or drop down the list and
select 'Discharged'. I have an array with the codes for each of the drop
down locations.
What I cannot do is to put DIS in the exit part after the user picks
'Discharged'.
I have tried setting the cText value OnClick or OnChange. No matter what I
try, however, I always get the description ('Discharged' for example) in the
text portion of the combo box.
METHOD cb1Change/cb1OnClick( oSender, nIndex ) CLASS TForm1
::oLabel3:cText := ::cb1ret[nIndex]
::cb1:cText := ::cb1ret[nIndex]
RETURN Nil
cb1ret is the array of codes.
oLabel3 shows the correct code picked
cb1 shows the full description.
What should I do?

ComboBox - 2 dimensional Array

Publicado: Jue Jun 16, 2005 11:26 am
por ignacio
Mike,
I am not sure if I understand you correctly:
Your problem is that you want 'ADM', 'TRN' or 'DIS' on oLabel3 and in the
edit field of the Combo-box, but on the Combo-box list you only want to have
'Admitted', 'Transfered' and 'Discharged'.
Is that right? Then I am afraid is not possible, the combo-box will always
try to select one string from the aItems array.
BTW, some clues:
To automatically search & update the combo-box value when the user types in
the edit field:
METHOD Combobox1EditChange( oSender ) CLASS TForm1
oSender:SelectString( oSender:GetText() )
RETURN Nil
To also update de Label3 with the array DATA aCombo:
METHOD Combobox1EditChange( oSender ) CLASS TForm1
local nAt
oSender:SelectString( oSender:GetText() )
nAt := oSender:nIndex
::oLabel1:cText := iif( nAt > 0, ::aCombo[nAt], "" )
RETURN Nil
Regards,
"Mike Draper" <draperm@cogeco.ca> escribió en el mensaje
news:[email=42b0e66b@ozsrvnegro.ozlan.local...]42b0e66b@ozsrvnegro.ozlan.local...[/email]
>I have several tables with a code and a description.
>
> for Example:
>
> ADM Admitted
> TRN Transferred
> DIS Discharged
>
> I want a combo box where the user can enter DIS or drop down the list and
> select 'Discharged'. I have an array with the codes for each of the drop
> down locations.
>
> What I cannot do is to put DIS in the exit part after the user picks
> 'Discharged'.
>
> I have tried setting the cText value OnClick or OnChange. No matter what
> I try, however, I always get the description ('Discharged' for example) in
> the text portion of the combo box.
>
> METHOD cb1Change/cb1OnClick( oSender, nIndex ) CLASS TForm1
> ::oLabel3:cText := ::cb1ret[nIndex]
> ::cb1:cText := ::cb1ret[nIndex]
> RETURN Nil
>
> cb1ret is the array of codes.
> oLabel3 shows the correct code picked
> cb1 shows the full description.
>
> What should I do?
>
>

ComboBox - 2 dimensional Array

Publicado: Jue Jun 16, 2005 2:36 pm
por Mike Draper
Ignacio
It almosts works. If I create a button with the OnClick code of:
::cb1:cText := ::cb1ret[::cb1:nIndex]
and click after making the combobox selection, it puts the code (DIS) in the
edit control.
It just does not do it when I put the same statement in a combobox event.
Or at least, I have not found the correct event. Is there an event AFTER
the control fills the edit part
where I can insert the statement?
"Ignacio Ortiz de Zúñiga" <InvalidAccount@ozs.com> wrote in message
news:42b145c4$[email=1@ozsrvnegro.ozlan.local...]1@ozsrvnegro.ozlan.local...[/email]
> Mike,
>
> I am not sure if I understand you correctly:
>
> Your problem is that you want 'ADM', 'TRN' or 'DIS' on oLabel3 and in the
> edit field of the Combo-box, but on the Combo-box list you only want to
> have 'Admitted', 'Transfered' and 'Discharged'.
>
> Is that right? Then I am afraid is not possible, the combo-box will always
> try to select one string from the aItems array.
>
> BTW, some clues:
>
> To automatically search & update the combo-box value when the user types
> in the edit field:
>
> METHOD Combobox1EditChange( oSender ) CLASS TForm1
>
> oSender:SelectString( oSender:GetText() )
>
> RETURN Nil
>
> To also update de Label3 with the array DATA aCombo:
>
> METHOD Combobox1EditChange( oSender ) CLASS TForm1
>
> local nAt
>
> oSender:SelectString( oSender:GetText() )
>
> nAt := oSender:nIndex
>
> ::oLabel1:cText := iif( nAt > 0, ::aCombo[nAt], "" )
>
> RETURN Nil
>
> Regards,
>
> "Mike Draper" <draperm@cogeco.ca> escribió en el mensaje
> news:[email=42b0e66b@ozsrvnegro.ozlan.local...]42b0e66b@ozsrvnegro.ozlan.local...[/email]
>>I have several tables with a code and a description.
>>
>> for Example:
>>
>> ADM Admitted
>> TRN Transferred
>> DIS Discharged
>>
>> I want a combo box where the user can enter DIS or drop down the list and
>> select 'Discharged'. I have an array with the codes for each of the drop
>> down locations.
>>
>> What I cannot do is to put DIS in the exit part after the user picks
>> 'Discharged'.
>>
>> I have tried setting the cText value OnClick or OnChange. No matter what
>> I try, however, I always get the description ('Discharged' for example)
>> in the text portion of the combo box.
>>
>> METHOD cb1Change/cb1OnClick( oSender, nIndex ) CLASS TForm1
>> ::oLabel3:cText := ::cb1ret[nIndex]
>> ::cb1:cText := ::cb1ret[nIndex]
>> RETURN Nil
>>
>> cb1ret is the array of codes.
>> oLabel3 shows the correct code picked
>> cb1 shows the full description.
>>
>> What should I do?
>>
>>
>
>