Items en un ComboBox

HMG en Español

Moderator: Rathinagiri

arroya2
Posts: 172
Joined: Thu Aug 06, 2009 7:16 am

Re: Items en un ComboBox

Post by arroya2 »

Translated by Google:
Hello Rossine.
aItems := _HMG_aControlMiscData1 [i,4]
When you run the program I get the following error:
_HMG_aControlMiscData1 Variable does not exist.

Thanks
Rafael Pérez
Hola Rossine.
aItems := _HMG_aControlMiscData1 [i,4]
Al ejecutar el programa me sale el siguiente error:
Variable _HMG_aControlMiscData1 no existe.

Gracias
Rossine
Posts: 87
Joined: Thu Jun 30, 2011 10:04 pm

Re: Items en un ComboBox

Post by Rossine »

Hello arroya2,
arroya2 wrote:
Translated by Google:
Hello Rossine.
aItems := _HMG_aControlMiscData1 [i,4]
When you run the program I get the following error:
_HMG_aControlMiscData1 Variable does not exist.

Thanks
Rafael Pérez
Hola Rossine.
aItems := _HMG_aControlMiscData1 [i,4]
Al ejecutar el programa me sale el siguiente error:
Variable _HMG_aControlMiscData1 no existe.

Gracias
This error occurred because I use Minigui extended ;)

One suggestion to solve this problem would be to change the source of hmg "h_combo.prg" look for this:

_HMG_SYSDATA [ 17 ] [k] := {}

and change for:

_HMG_SYSDATA [ 17 ] [k] := rows

And then regenerate the libs hmg

In my exemple change this:

aItems := _HMG_aControlMiscData1 [i,4]

for:

aItems := _HMG_SYSDATA [ 17 ]

See if this works for you ;)

Observation: The right way is Mr.Rathinagiri or Mr.Roberto say whether this change in core hmg is correct

Regards,

Rossine.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Items en un ComboBox

Post by esgici »

Hola Rafael

Could you try this too,

I hope will be useful for your need. :)

Saludos

--

Esgici
Interaction between two combobox; screen shoot
Interaction between two combobox; screen shoot
CBX2.PNG (43.63 KiB) Viewed 3299 times
CBX2.zip
Interaction between two combobox; .hbp & .prg
(847 Bytes) Downloaded 254 times
Viva INTERNATIONAL HMG :D
User avatar
luisvasquezcl
Posts: 1258
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Contact:

Re: Items en un ComboBox

Post by luisvasquezcl »

Hola Rafael.

Usa el evento on change del combobox.

por ejemplo
define combobox combo1
...
on change carga_datos()
end combobox
define combobox combo2
...
end combobox

procedure carga_datos()
form.combo2.deleteallitems
mitabla->( dbseek( form.combo1.value ) )
if found()
do while mitabla->codigo = form.combo1.value
form.combo2.additem( mitabla->nombre )
mitabla->( dbskip() )
enddo
endif
return

espero te sea de ayuda.
saludos cordiales,
Luis Vasquez.
arroya2
Posts: 172
Joined: Thu Aug 06, 2009 7:16 am

Re: Items en un ComboBox

Post by arroya2 »

Hola amigos:
Me habéis solucionado el problema de diferentes formas. Yo me he quedado con la siguiente:

Code: Select all

// En el array aItems0 están almacenados los Items del ComboBox_1 (en este ejemplo se suponen 3 Items) de la ventana wVentana
// En el array aItems1 están almacenados los Items para el ComboBox_2 si en el ComboBox_1 seleccionamos la primera opción.
// En el array aItems2 están almacenados los Items para el ComboBox_2 si en el ComboBox_1 seleccionamos la segunda opción.
// En el array aItems3 están almacenados los Items para el ComboBox_2 si en el ComboBox_1 seleccionamos la tercera opción.

Local n

wVentana.ComboBox_2.DeleteAllItems()

If wVentana.ComboBox_1.Value:=1
    For n:=1 To Len(aItems1)
        wVentana.ComboBox_2.AddItem(aItems1[n])
    Next
ElseIf wVentana.ComboBox_1.Value:=2
    For n:=1 To Len(aItems2)
        wVentana.ComboBox_2.AddItem(aItems2[n])
    Next
ElseIf wVentana.ComboBox_1.Value:=3
    For n:=1 To Len(aItems3)
        wVentana.ComboBox_2.AddItem(aItems3[n])
    Next
EndIf
Muchas gracias a todos

Saludos
Rafael Pérez
Hello friends:
I have solved the problem in different ways. I am left with the following:

Code: Select all

// In the aItems0 array is stored the Items of ComboBox_1  (in this example assumes 3 Items) of window wVentana
// In the aItems1 array is stored the Items for ComboBox_2 if the ComboBox_1 select the first option.
// In the aItems2 array is stored the Items for ComboBox_2 if the ComboBox_1 select the second option.
// In the aItems3 array is stored the Items for ComboBox_2 if the ComboBox_1 select the third option.

Local n

wVentana.ComboBox_2.DeleteAllItems()

If wVentana.ComboBox_1.Value:=1
    For n:=1 To Len(aItems1)
        wVentana.ComboBox_2.AddItem(aItems1[n])
    Next
ElseIf wVentana.ComboBox_1.Value:=2
    For n:=1 To Len(aItems2)
        wVentana.ComboBox_2.AddItem(aItems2[n])
    Next
ElseIf wVentana.ComboBox_1.Value:=3
    For n:=1 To Len(aItems3)
        wVentana.ComboBox_2.AddItem(aItems3[n])
    Next
EndIf
Thank you very much to all

Regards
Rafael Pérez
Post Reply