DCCOMBOBOX more levels

This forum is for eXpress++ general support.
Message
Author
Victorio
Posts: 621
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

DCCOMBOBOX more levels

#1 Post by Victorio »

Hi,

How can I use DCCOMBOBOX with more than one level.

For example 1st select
ALFA
BETA
GAMA

then, if select ALFA, show other x items ALFA1,ALFA2,ALFA3
when BETA, then y items, ! no same number BETA1,BETA2,BETA3,BETA4,BETA5.

something as tree but with COMBOBOX :

acmenupsh2:={ ;
"C-PARCELY", ;
"E-PARCELY", ;
"LISTY VLASTNÍCTVA", ;
"LISTY VLASTNÍCTVA-VŠETKY SÚBORY", ;
"VLASTNÍCI/ÚČASTNÍCI", ;
"NÁJOMCOVIA", ;
"PRÁVNE VZŤAHY", ;
"BYTY A NEBYTOVÉ PRIESTORY", ;
"STAVBY NA POZEMKU", ;
"VŠETKY SÚBORY" , ;
"PRERUŠIŤ"}
amenupsh2:={ ;
1, ;
2, ;
3, ;
4, ;
5, ;
6, ;
7, ;
8, ;
9, ;
10,;
11}

cmenupsh2 := '' // do tejto premennej sa uloží vybraná položka, caption
menupsh2 := 1 // do tejto premennej sa uloží vybraná položka, value

@ 30,7 DCSAY 'Výber údajového súboru' SAYSIZE 0 SAYBOTTOM

* codeblock pre aktualizáciu výberu aComboCaptionskey1 do cComboCaptionkey1 a
* cComboValueskey1 do menupsh2
bGetSet := DC_ComboGetSetBlock( acmenupsh2, amenupsh2, ;
@cmenupsh2, @menupsh2 )

@ 31, 10 DCCOMBOBOX bGetSet TYPE XBPCOMBO_DROPDOWNLIST NOTABSTOP ;
LIST acmenupsh2 ;
SIZE 60, 6 ;
ITEMSELECTED {||DC_ComboSelectedBlock( acmenupsh2, amenupsh2, ;
@cmenupsh2, @menupsh2 )}

here I need second level also COMBOBOX type

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCCOMBOBOX more levels

#2 Post by Auge_Ohr »

hi

not sure if Windows even have a Control like you want.
have you ever see a Control like you want in a M$ App ?

perhaps you can work with 2 x Combobox (hide/show) ...

---

i think it is like a TreeView where you have to click on ROOT Item to expand Node to see SubItem.
same can made with ListView Groupmodus where you can have more Column for SubItem.
greetings by OHR
Jimmy

Victorio
Posts: 621
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DCCOMBOBOX more levels

#3 Post by Victorio »

hi Jimmy,

I still work on this, yes I want same as tree view but with buttons, as in DCCOMBOBOX function.
now I test two dimensional array for use , but I do not know, how "send" selected row from main combobox to secondary.

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCCOMBOBOX more levels

#4 Post by Auge_Ohr »

have a look at \Source\samples\solution\Resize\Picklist.prg if this is what you want
greetings by OHR
Jimmy

Victorio
Posts: 621
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DCCOMBOBOX more levels

#5 Post by Victorio »

no , I do not want selecting items.

tree is like :

Alfa
- alfa 1 - when selected, put name, surname,....
- alfa 2 - when selected, put number telephone...
- alfa 3 - etc
beta
- beta 1
- beta 2
gama
- gama 1....

and when select alfa - alfa 2, program show next dialog to say/get values, which are for every item different.

and dialog I need like this
**************************** ************************
Select type 1 * ---> Select type 2
**************************** ************************
ALFA x * ALFA 1
BETA * ALFA 2 x
GAMA *
****************************

Victorio
Posts: 621
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DCCOMBOBOX more levels

#6 Post by Victorio »

sorry, my ilustration is not good, here how is in program >

:D now I found perfect example in eXpress, PBStack, where is this what I searching and want.., only modify for my user dialog...
Attachments
picture2.gif
picture2.gif (13.17 KiB) Viewed 12912 times
picture1.gif
picture1.gif (9.66 KiB) Viewed 12914 times

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCCOMBOBOX more levels

#7 Post by Auge_Ohr »

Victorio wrote: :D now I found perfect example in eXpress, PBStack
i have wrote PbStack 2008 to simulate Outlook Buttons on left Side.
Roger have made a more beautiful Version see \exp20\Samples\OutlookBar\
greetings by OHR
Jimmy

Victorio
Posts: 621
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DCCOMBOBOX more levels

#8 Post by Victorio »

thank's Jimmy, i will look for this.

Victorio
Posts: 621
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DCCOMBOBOX more levels

#9 Post by Victorio »

Hi again,

Here is example,when I want use two comboboxes.
When I select "A" from primary, then secondary show A1,A2,A3
Whem select "B", then secondary B1,B2,B3

I do not know connect it, when use bBlock , not work, I want use two arrays.

Is this possible without DC_Vartolistbox() ?
Attachments
ComboRefresh3.zip
(12.68 KiB) Downloaded 665 times

Victorio
Posts: 621
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DCCOMBOBOX more levels

#10 Post by Victorio »

Hi again,
I have already solved it :dance:

Certainly it is not clear and simplyest solution, but works.

#include 'dcdialog.ch'
#include 'appevent.ch'
#include 'xbp.ch'
#include "common.ch"

function main()

LOCAL aArray := {{'A','B','C'},{'1','2','3'}} // zadefinovanie poľa pre combobox, pozor, čísla v 2 časti poľa neakceptuje ale zobrazuje podadie
*LOCAL aArray2 := {{'A1','B1','C1'},{'A2','B2','C2'}} // zadefinovanie poľa pre combobox, pozor, čísla v 2 časti poľa neakceptuje ale zobrazuje podadie
LOCAL aArray2 := {{'A1','A2','A3'},{'B1','B2','B3'},{'C1','C2','C3'}} // zadefinovanie poľa pre combobox, pozor, čísla v 2 časti poľa neakceptuje ale zobrazuje podadie
LOCAL aArray2p:={}
LOCAL cSelect := 'A' // predvolenie nastavenia na položku
LOCAL cSelect2 := 'A1' // predvolenie nastavenia na položku
LOCAL GetOptions, GetList := {}
LOCAL bBlock:=1,bBlockp,bBlockx // premenné pre codebloky
LOCAL p:={{},{}},q:={{},{}} // zadefinovanie pomocnej premennej array pre posunutie hodnôt ďalej v programe
LOCAL oCombobox,oCombobox2

p[1]:=1
q[1]:=1
aArray2p:=aArray2[1]

* primary COMBOBOX
******************
@ 1,4 DCCOMBOBOX cSelect ;
LIST aArray[1] ; // výber popisov polí
TYPE XBPCOMBO_DROPDOWNLIST ;
SIZE 5.7,4 ;
ITEMMARKED {|a,b,o| o:xbpsle:getdata(), p:=o:xbpListBox:getdata(), DC_GetRefresh(GetList,'CSELECTION1'),DC_GetRefresh(GetList,'CSELECTION3'),DC_GetRefresh(GetList,'CSELECTION5')} ;
ITEMSELECTED {|a,b,o| iif(!o:listboxfocus(), ;
(o:xbpsle:getdata(),q:=o:xbpListBox:getdata(),DC_GetRefresh(GetList,'CSELECTION2'),DC_GetRefresh(GetList,'CSELECTION4'),DC_GetRefresh(GetList,'CSELECTION5')) ;
,NIL),aArray2p:=aArray2[q[1]],DC_VarToListBox(oComboBox2)}

* secondary COMBOBOX
*********************
* bBlock := {|| q[1]}
@ 1,40 DCCOMBOBOX cSelect2 ;
LIST aArray2p ; // výber popisov polí
TYPE XBPCOMBO_DROPDOWNLIST ;
SIZE 15.7,4 ;
ID 'CSELECTION5' ;
OBJECT oCombobox2

* ITEMMARKED {|a,b,o| o:xbpsle:getdata(), p:=o:xbpListBox:getdata(), DC_GetRefresh(GetList,'CSELECTION1'),DC_GetRefresh(GetList,'CSELECTION3')} ;
* ITEMSELECTED {|a,b,o| iif(!o:listboxfocus(), ;
* (o:xbpsle:getdata(),q:=o:xbpListBox:getdata(),DC_GetRefresh(GetList,'CSELECTION2'),DC_GetRefresh(GetList,'CSELECTION4')) ;
* ,NIL)}
*


*cBuffer:= oCombobox:XbpSLE:getData() // from entry field
*aItems := oCombobox:XbpListBox:getData() // from list box


* this works fine, captions and row numbers show correctly

* zobrazí na ktorom zázname je nastavený - jeho popis
bBlock := {|| cSelect}
@ 3,1 DCSAY bBlock ;
ID 'CSELECTION1' ;
SAYSIZE 25

* zobrazí na ktorom zázname je nastavený - jeho poradie, tj. číslo, ale poradie !, nie toto čo je uvedené v array hore
bBlock := {|| p[1]}
@ 5,1 DCSAY bBlock ;
ID 'CSELECTION3' ;
SAYSIZE 25

* zobrazí ktorý záznam je vybraný - jeho popis
bBlock := {|| cSelect}
@ 7,1 DCSAY bBlock ;
ID 'CSELECTION2';
SAYSIZE 25

* zobrazí ktorý záznam je vybraný - jeho poradie, tj. číslo, ale poradie !, nie toto čo je uvedené v array hore
bBlock := {|| q[1]}
@ 9,1 DCSAY bBlock ;
ID 'CSELECTION4' ;
SAYSIZE 25

/* only test,if show q1 with CSELECTION5
* tu len pokus ako sa to správa, ID je dôležité aby tu bolo aj hore DC_Getrefresh, inak ho nenačíta neaktualizuje
bBlock:={|| q[1]}
@ 11,1 DCSAY bBlock ;
ID 'CSELECTION5' ;
SAYSIZE 25
*/

DCREAD GUI FIT

RETURN NIL

PROCEDURE APPSYS()
RETURN



* toto z donnay fóra, malo by naplniť listbox

STATIC FUNCTION FillItems(selnumr,aItems,GetList)

IF selnum==1
aItems := {'A1','A2','A3'}
ELSEIF selnum==2
aItems := {'B1','B2','B3'}
ELSEIF selnum==3
aItems := {'C1','C2','C3'}
ENDIF

DC_VarToListBox(oComboBox2, aItems)

cArray2 := aItems[1]

DC_GetRefresh(GetList)

RETURN Nil
Attachments
show.gif
show.gif (7.67 KiB) Viewed 12881 times

Post Reply