popolate a combobox

popolate a combobox

Postby Silvio.Falconi » Fri Dec 09, 2016 5:46 pm

I have an archive dbf with two character fields:

GEMATERIA 40 CR
GEPCLAVE 45 CR

I use this for a tree selection for categories and subcategories :

Image


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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: popolate a combobox

Postby Silvio.Falconi » Fri Dec 09, 2016 6:01 pm

RESOLVED !!!
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 99 guests