GEMATERIA 40 CR
GEPCLAVE 45 CR
I use this for a tree selection for categories and subcategories :
Now I wish create two combobox the first must show only the main category field (gemateria) and the second the subcategories of the main category
How I can make it ?
I tried this test ( but it is wong because I not Know how reload the subcategories of the category selected)
- Code: Select all Expand view
#include "fivewin.ch"
#include "constant.ch"
Function Test_combo()
Local aLins := {}
Local aMars := {}
Local oDlgCombo,oMar,oLin
Local nBottom := 14.2
Local nRight := 55
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
AAdd(aLins,"<Tutte>")
AAdd(aMars,"<Tutte>")
USE GRUENT ALIAS GE
INDEX ON UPPER(GE->GEMATERIA)+UPPER(GE->GEPCLAVE) TAG GE01 FOR !Deleted()
INDEX ON UPPER(GE->GEMATERIA) TAG GE02 FOR ((!DELETED()) )
INDEX ON UPPER(GE->GEPCLAVE) TAG GE03 FOR ((!DELETED()) )
GE->(DbSetOrder(1))
GE->(DbGotop())
DO WHILE !GE->(EoF())
if Rtrim(GE->GEPClave) == ""
IF AScan(aLins,GE->GEMATERIA )=0
AAdd(aLins,GE->GEMATERIA)
ENDIF
ELSE
AAdd(aMars,(GE->GEPCLAVE))
ENDIF
GE->(DbSkip())
ENDDO
DEFINE DIALOG oDlgCombo ;
TITLE"test combo" ;
SIZE nWidth, nHeight PIXEL ;
STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION, 4 )
@ 12, 2 SAY "Categoria :" OF oDlgCombo PIXEL SIZE 90, 12
@ 24, 2 SAY "SottoCategoria :" OF oDlgCombo PIXEL SIZE 90, 12
@ 10, 55 COMBOBOX oLin ITEMS aLins SIZE 90, 50 OF oDlgCombo PIXEL
@ 22, 55 COMBOBOX oMar ITEMS aMars SIZE 90, 50 OF oDlgCombo PIXEL
ACTIVATE DIALOG oDlgcombo CENTERED
return nil