Hi All,
Three issues for which I require help.
Case:
I am using listbox multiselect for giving the user choice to select more than
one option in the list box. Presently the user has to use <Ctrl>+ <LeftClick> to select mulitiple items.
My questions are:
1. How to know, as to which row of the list box the cursor is on, say for
example when the user uses the DBLCLICK option. This is so that that row can be
added to the Listbox.Value array. Presently the ListBox.Value option contains an array of selected items and not the row number on which the user has clicked.
2. If the size of array is say 200, then we have to give some kind of search
facility to the user, if this is the case, then how can we use a different key
combination other than <Ctrl>+ <LeftClick> for selection say <F2> for Search and Select.
3. Where can I find more information about LISTBOXSETMULTISEL() function. This function seems to be controlling the Multiselect function. The details of this
function is not available in the source directory of MiniGui.
Any help will be greatly appreciated, otherwise I will have to switch to some
other form of control (eg. Browse) to achieve my purpose.
I had asked this question in the HMG extended forum, but I did not receive any reply, probably one of the Gurus here can help me solve my problem.
Warm regards,
Jayadev.
ListBox - Multiselect
Moderator: Rathinagiri
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: ListBox - Multiselect
Hello Jayadevu
Welcome aboard
Before all, sorry for my delay for saying "welcome" to you and replying your post.
But please don't worry about delay ( or lack ) of responses. Everybody has own priorities and this is a very relative concept
As an example ( not a complaint, only example ), some my posts (including samples) has been viewed more than 100 times and haven't a single reply
Regarding you questions on LISTBOX :
Please take look following sample ( slightly modified version of C:\hmg\SAMPLES\LISTBOX\demo1.prg ) :
And please test it with MULTISELECT for .T. and .F. case.
As you will easily see there isn't any problem in behavior of this control. In fact, every HMG control is built on Win32 API's controls and all of them designed on very long experimentations.

I hope that I could help you.
Please don't hesitate for asking anything more. You also use my private a-mail address : esgici @ gmail.com
Again, welcome aboard and happy HMG'ing
With regards
--
Esgici
Welcome aboard

Before all, sorry for my delay for saying "welcome" to you and replying your post.
But please don't worry about delay ( or lack ) of responses. Everybody has own priorities and this is a very relative concept

As an example ( not a complaint, only example ), some my posts (including samples) has been viewed more than 100 times and haven't a single reply

Regarding you questions on LISTBOX :
Please take look following sample ( slightly modified version of C:\hmg\SAMPLES\LISTBOX\demo1.prg ) :
Code: Select all
/*
* Harbour MiniGUI Hello World Demo
* (c) 2002-2004 Roberto Lopez <harbourminigui@gmail.com>
*/
#include "minigui.ch"
PROC Main
DEFINE WINDOW Win1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 400 ;
TITLE 'List Box Tests' ;
MAIN
DEFINE LISTBOX LIST1
ROW 10
COL 10
WIDTH 100
HEIGHT 110
ITEMS { '01','02','03','04','05','06','07','08','09','10' }
ONCHANGE DispValue( THIS.VALUE )
ONDBLCLICK SayValue( THIS.VALUE )
MULTISELECT .T.
END LISTBOX
DEFINE STATUSBAR
STATUSITEM ""
END STATUSBAR
END WINDOW
CENTER WINDOW Win1
ACTIVATE WINDOW Win1
Return
PROC DispValue( xLBValue )
LOCAL nItem := 0,; // Selected Item Number
cVList := '' // Value lis ( in string format )
IF VALTYPE( xLBValue ) == "N"
Win1.StatusBar.Item(1) := LTRIM( STR( THIS.VALUE ) )
ELSE
FOR nItem := 1 TO LEN( xLBValue )
cVList += LTRIM( STR( xLBValue[ nItem ] ) ) + IF( nItem < LEN( xLBValue ), ",", "" )
NEXT nItem
Win1.StatusBar.Item(1) := cVList
ENDIF
RETU // DispValue()
PROC SayValue( xLBValue )
LOCAL cSelItemNo := ''
IF VALTYPE( xLBValue ) == "N"
cSelItemNo := LTRIM( STR( xLBValue ) )
ELSE
cSelItemNo := LTRIM( STR( xLBValue[ 1 ] ) )
ENDIF VALTYPE( xLBValue ) == "N"
MsgBox( cSelItemNo + " Double Clicked !" )
RETU // SayValue()
As you will easily see there isn't any problem in behavior of this control. In fact, every HMG control is built on Win32 API's controls and all of them designed on very long experimentations.
As you will see above example, selecting item(s) and double clicking are separate actions of user. Whatever selection (multiple or single) done, when double clicking, selection processes terminates and double clicking event fired.1. How to know, as to which row of the list box the cursor is on, say for example when the user uses the DBLCLICK option. This is so that that row can be added to the Listbox.Value array. Presently the ListBox.Value option contains an array of selected items and not the row number on which the user has clicked.
When you want make a search, you will need a separate "place" for enter your search string. This place will be a TEXTBOX normally. And you need to "link" or "combine" this two control. We have such control namely COMBOBOX2. If the size of array is say 200, then we have to give some kind of search facility to the user, if this is the case, then how can we use a different key combination other than <Ctrl>+ <LeftClick> for selection say <F2> for Search and Select.

Are you sure that exits ( or MUST exist ) such function ?3. Where can I find more information about LISTBOXSETMULTISEL() function. This function seems to be controlling the Multiselect function. The details of this function is not available in the source directory of MiniGui.
I hope that I could help you.
Please don't hesitate for asking anything more. You also use my private a-mail address : esgici @ gmail.com
Again, welcome aboard and happy HMG'ing

With regards
--
Esgici
Viva INTERNATIONAL HMG 

Re: ListBox - Multiselect
Dear Esgici,
Many thanks for your warm words of welcome, and many more thanks for the sample. Now I understand the working of Listbox Multiselect.
Warm regards,
Jayadev
Many thanks for your warm words of welcome, and many more thanks for the sample. Now I understand the working of Listbox Multiselect.
Warm regards,
Jayadev