Page 2 of 2

Re: Items en un ComboBox

Posted: Tue Jul 03, 2012 3:51 pm
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

Re: Items en un ComboBox

Posted: Tue Jul 03, 2012 5:09 pm
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.

Re: Items en un ComboBox

Posted: Wed Jul 04, 2012 10:37 pm
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 4346 times
CBX2.zip
Interaction between two combobox; .hbp & .prg
(847 Bytes) Downloaded 328 times

Re: Items en un ComboBox

Posted: Fri Jul 06, 2012 1:07 pm
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.

Re: Items en un ComboBox

Posted: Wed Jul 18, 2012 7:40 pm
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