ComboCheckList

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

ComboCheckList

Post by zolysoftsolutions »

Hello my friends,

I wish to have a possibility to check multiple items from a combobox.

By example: I have in the combo items 7 colours, but I want to mark in some way 3 of them and the value of the combo to be retourned as an array.

I checked the samples, I searched the forum. Don't found something like this.

Can somebody give me a tip?

I can solve with a textbox, a commandbutton and a visible/invisible list, but I feel that exist something more simple here. :)

I am using HMG 3.1.1

Best regards,
Zoli B.
_______________________________
Open eyes for you!
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: ComboCheckList

Post by Rathinagiri »

Mulitselect is available only in ListBox and Grid controls. I don't think it is possible in a combobox as of now.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

Re: ComboCheckList

Post by zolysoftsolutions »

Thank you for information Rathinagiri.

So I have to write a function with the 3 controls combination: textbox to display the current value, a commandbutton for make the list visible/invisible, and a list with the items and with multiselect.

something like:

xchoices:={'Red','White','Blue','Black','Yellow'}
xresult:={}
xresult:=combocheck(25,40,xchoices)

;) Happy HMG-ing...

Best regards,
Zoli B.
_______________________________
Open eyes for you!
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: ComboCheckList

Post by Javier Tovar »

Hi zolysoftsolutions

Code: Select all

/*
* HMG Hello World Demo
* (c) 2002-2004 Roberto Lopez <mail.box.hmg@gmail.com>
*/

#include "hmg.ch"

Function Main
PUBLIC aItems := { 'Hola','Como','Estas','En','Este','Dia' }
	DEFINE WINDOW Win1 ;
		AT 0,0 ;
		WIDTH 400 ;
		HEIGHT 400 ;
		TITLE 'DRAGITEMS LISTBOX' ;
		MAIN 

		DEFINE LISTBOX LIST1
			ROW		10
			COL		10
			WIDTH		100
			HEIGHT		110
			ITEMS aItems
			MULTISELECT .T.
			ONLOSTFOCUS VerSeleccion()
		END LISTBOX
		
		DEFINE TEXTBOX TEXT_1
			ROW		10
			COL		200
			WIDTH		100
			HEIGHT		20
		END TEXTBOX
		

	END WINDOW

	Win1.Center

	ACTIVATE WINDOW Win1 

Return

PROCEDURE VerSeleccion()
LOCAL aValores := Win1.List1.VALUE

FOR n:= 1 TO Len(aValores)
	MsgBox(STR(aValores[n]) + " " +aItems[aValores[n]])
NEXT n

RETURN NIL
Regards
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

Re: ComboCheckList

Post by zolysoftsolutions »

Hi,

As a beginner I solved the problem in folowing way:

The combocheck function will create the possibility to check from the list multiple items, but at overall look like a combo with multiple selection.
Not all the time we have place to keep the listbox visible.

Is not very proffesionist, but it works, and for me is very usefoul. I shared it, maybe is usefoul also for others.

First parameter is windowname.
Second is a name allocated by user. The checked items will be stored
as a string in the textbox created by the function. By example, in this case the textbox
name is "ccnametext". The main.ccnametext.value is really the result of the function.

Third parameter is the row where the texbox is placed

Fourth parameter is the column where the texbox is placed

Fifth is the leght of the textbox. The overall lenght of the combocheck will be this value+24

Sixth parameter is the name of the array containing the elements of the list

The example attached.

Best regards,
Zoli B.
Attachments
combocheck.zip
(997 Bytes) Downloaded 253 times
_______________________________
Open eyes for you!
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: ComboCheckList

Post by danielmaximiliano »

Thank´s Zoli ...

New User.Component
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: ComboCheckList

Post by danielmaximiliano »

Hola Claudio:

es posible esto ?
una forma de habilitar multiple seleccion de un ComboBox

is this possible?
a way to enable multiple selection in a ComboBox

http://www.codeproject.com/Articles/210 ... -Class-and
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

Re: ComboCheckList

Post by zolysoftsolutions »

Updated. No problems with controls overlapping.

Code attached.

When the items are selected, you have to press a simple Enter, or to click inside the textbox above.

Best regards,
Zoli B.
Attachments
combocheck.zip
(1.16 KiB) Downloaded 254 times
_______________________________
Open eyes for you!
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: ComboCheckList

Post by Javier Tovar »

Hola zolysoftsolutions,

Ahora si que me sorprendiste :o
Combinando varios controles podemos llegar a "otro" que llena nuestras necesidades! Excelente!

Felicidades.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Hello zolysoftsolutions,

Now if that surprised me :o
Combining multiple controls can come to "other" that fills our needs! Excellent!

Congratulations.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: ComboCheckList

Post by srvet_claudio »

danielmaximiliano wrote:Hola Claudio:

es posible esto ?
una forma de habilitar multiple seleccion de un ComboBox

is this possible?
a way to enable multiple selection in a ComboBox

http://www.codeproject.com/Articles/210 ... -Class-and
Hola Daniel,
voy a estudiar el asunto.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply