A better Listbox/Combobox

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

User avatar
raumi75
Posts: 135
Joined: Wed Dec 17, 2008 2:31 am
Location: Lünen, Germany
Contact:

A better Listbox/Combobox

Post by raumi75 »

Hello,

I only use hmg for a few weeks now, but already, I am amazed, what I can do with my old clipper-code.

Of course, I still have some wishes left. The Listbox/Combobox-behaviour is something that could be improved.

When the user types a key, the first item that starts with that letter gets selected. But when the user types the second letter, it jumps to the first item that starts with that letter.

Much better would be the behaviour of the Firefox-Combobox: The second key gets interpreted as the second letter of the item. If you pause for a while, the key is interpreted as the first letter, again.

When dealing with long lists, it would make it so much more comfortable.

I am not sure, if you can change the Combobox, or if you just use the Windows API.

Have a nice weekend

Raumi75
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: A better Listbox/Combobox

Post by Rathinagiri »

Hi,

Thanks for trying HMG. :)

The feature you are mentioning, is already there Raumi.

The only thing is, you have to add the option "Sort".

This is the syntax for combobox from Roberto's reference.

Code: Select all

@ <nRow> ,<nCol> 
		COMBOBOX <ControlName> 
		[ OF | PARENT <ParentWindowName> ]
		[ ITEMS <caItems> ] 
		[ ITEMSOURCE <ItemSourceField1> [ , <ItemSourceField2> ] ]
		[ VALUE <nValue> ] 
		[ VALUESOURCE <ValueSourceField> ]
		[ DISPLAYEDIT ]
		[ WIDTH <nWodth> ] 
		[ HEIGHT <nHeight>]
		[ FONT <cFontName> SIZE <nFontSize> ] 
		[ BOLD ] [ ITALIC ] [ UNDERLINE ] [ STRIKEOUT ]
		[ TOOLTIP <cToolTipText> ] 
		[ ON GOTFOCUS <OnGotFocusProcedur> | <bBlock> ]
		[ ON CHANGE <OnChangeProcedure> | <bBlock> ] 
		[ ON LOSTFOCUS <OnLostFocusProcedure> | <bBlock> ]
		[ ON ENTER <OnEnterProcedure> | <bBlock> ]
		[ ON DISPLAYCHANGE <OnDisplayChangeProcedure> | <bBlock> ]
		[ ON DROPDOWN <OnDropDownProcedure> | <bBlock> ]
		[ ON CLOSEUP <OnCloseUpProcedure> | <bBlock> ]
		[ NOTABSTOP ]
		[ HELPID <nHelpId> ] 
		[ BREAK ]
		[ GRIPPERTEXT <cGripperText> ] 
		[ INVISIBLE ]
		[ SORT ] 
		[ IMAGE <acImageNames> ]  
		[ DROPPEDWIDTH <nDroppedWidth> ]  
In this, after invisible, you can see an option SORT.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
raumi75
Posts: 135
Joined: Wed Dec 17, 2008 2:31 am
Location: Lünen, Germany
Contact:

Re: A better Listbox/Combobox

Post by raumi75 »

rathinagiri wrote: The only thing is, you have to add the option "Sort".
Hello rathinagiri,

thank you for the quick reply. Great to hear that this feature is already implemented.
I just did not expect the SORT-option to do that.

Raumi75
User avatar
tonton2
Posts: 444
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: A better Listbox/Combobox

Post by tonton2 »

Bonsoir tout le monde,
où dois je mettre l'option "SORT" du COMBOBOX dans la grille suivante 'GRID09' à la ligne 54
grand merci a vous

Hi everyone,
Where must I put the "SORT" option COMBOBOX in the following grid 'GRID09' on line 54.
big thank you to you all

Code: Select all

/*
* HMG Grid Demo
* (c) 2005 Roberto Lopez
*/

#include "hmg.ch"

Function Main

Local aRows [20] [3]

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 640 ;
		HEIGHT 400 ;
		TITLE 'Mixed Data Type Grid Test' ;
		MAIN 

		DEFINE MAIN MENU
			DEFINE POPUP 'File'
				MENUITEM 'Set Item'	ACTION SetItem()
				MENUITEM 'Get Item'	ACTION GetItem()
			END POPUP
		END MENU

		aRows [1]	:= {113.12,date(),1,1 , .t. }
		aRows [2]	:= {123.12,date(),2,2 , .f. } 
		aRows [3]	:= {133.12,date(),3,3, .t. } 
		aRows [4]	:= {143.12,date(),1,4, .f. } 
		aRows [5]	:= {153.12,date(),2,5, .t. } 
		aRows [6]	:= {163.12,date(),3,6, .f. } 
		aRows [7]	:= {173.12,date(),1,7, .t. } 
		aRows [8]	:= {183.12,date(),2,8, .f. } 
		aRows [9]	:= {193.12,date(),3,9, .t. } 
		
		@ 10,10 GRID Grid_1 ;
		WIDTH 620 ;
		HEIGHT 330 ;
		HEADERS {'Column 1','Column 2','Column 3','Column 4','Column 5'} ;
		WIDTHS {140,140,140,140,140} ;
		ITEMS aRows ;
		EDIT ON CHANGE playbeep() ;
		COLUMNCONTROLS { {'TEXTBOX','NUMERIC','$ 999,999.99'} , {'DATEPICKER','DROPDOWN'} ,{'COMBOBOX',{'One','Two','Three'}}, { 'SPINNER' , 1 , 20 } , { 'CHECKBOX' , 'Yes' , 'No' } } ;
		CELLNAVIGATION

	END WINDOW

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return

PROCEDURE SETITEM()

	Form_1.Grid_1.Item (2) := { 123.45 , date() , 2 , 10 , .T. }

RETURN
L'Algerie vous salut
Y.TABET
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: A better Listbox/Combobox

Post by esgici »

Salaam aleik Tabet
tonton2 wrote: Where must I put the "SORT" option COMBOBOX in the following grid 'GRID09' on line 54.
COLUMNCONTROLS property of GRID is a very handy feature.

But controls used in this property are limited versions of _real_ controls;
haven't all "specialties" ( properties, methods, events ) of them.

As an example, although when COMBOBOX control used alone has more than 30 "specialties", as a COLUMNCONTROL in GRID has only three:

Code: Select all

      COMBOBOX
 
      { cControlType , acItems , axReturnValues }

      cControlType      'COMBOBOX' (Required)
      acItems           (Required)
      axReturnValues    (Optional)
As a result : we can't use SORT ( and many other ) property of self-contained COMBOBOX, in the COMBOBOX as COLUMNCONTROL in GRID.

Maassalaam

Happy HMG :D
Last edited by esgici on Sun Nov 10, 2013 9:00 am, edited 1 time in total.
Viva INTERNATIONAL HMG :D
User avatar
tonton2
Posts: 444
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: A better Listbox/Combobox

Post by tonton2 »

Alakum assalam,
Merci beaucoup mon ami
thank you very much my friend
L'Algerie vous salut
Y.TABET
User avatar
tonton2
Posts: 444
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: A better Listbox/Combobox

Post by tonton2 »

Hi to all the team,
can you be used in place of COMBOBOX => COMBOBOXSEARCH ?
if so, how do it?
Merci beaucoup
L'Algerie vous salut
Y.TABET
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: A better Listbox/Combobox

Post by esgici »

Hi Tabet
tonton2 wrote: can you be used in place of COMBOBOX => COMBOBOXSEARCH ?
if so, how do it?
Where ?

If in any form as a _normal_ control, yes;

if in GRID as a column control, no :(

A column control in GRID may be : TEXTBOX, DATEPICKER, COMBOBOX, SPINNER or CHECKBOX.

Happy HMG :D

Maassalam
Viva INTERNATIONAL HMG :D
User avatar
tonton2
Posts: 444
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: A better Listbox/Combobox

Post by tonton2 »

COLUMNCONTROLS { {'TEXTBOX','NUMERIC','$ 999,999.99'} , {'DATEPICKER','DROPDOWN'} ,{'COMBOBOX',{'One','Two','Three'}},
merci,
thank you so much now, I'll find another way to do it
L'Algerie vous salut
Y.TABET
User avatar
tonton2
Posts: 444
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: A better Listbox/Combobox

Post by tonton2 »

raumi75 wrote:Hello,

......
When the user types a key, the first item that starts with that letter gets selected. But when the user types the second letter, it jumps to the first item that starts with that letter.............; The second key gets interpreted as the second letter of the item.., etc...
.......
When dealing with long lists, it would make it so much more comfortable.
Raumi75
c'est ce que je veux faire dans la grille avec un equivalent de COMBOSEARCHBOX

this is what I want to do in the grid with an equivalent of a COMBOSEARCHBOX
Assalama
L'Algerie vous salut
Y.TABET
Post Reply