Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup as a list & MULTISELECT

Status
Not open for further replies.

ChrisMc

Programmer
Apr 24, 2002
43
GB
This is driving me up the wall!
Firstly, Dave S helped a lot regarding monospaced fonts in a popup which seems will only happen when Foxfont is used. So moving on, the program below is the essence of what I am trying to do - have multi-selections in a list.
This works *perfectly* if the selection is made using the keyboard - highlight an entry, hit return, multiple items can be selected. However, if an item is double-blipped with the mouse, all previously marked items disappear!
LASTKEY() in both scenarios returns 13

I'm sure it's me and I can't see the wood for the trees but ANY help on this would be greatly appreciated.

Chris

Code:
USE <a_table>

DEFINE POPUP PopName;
	MARGIN ;
	MULTISELECT ;
	SCROLL

BarNo = 1
SCAN
	DEFINE BAR BarNo OF PopName ;
                   PROMPT <field_from_a_table>
	BarNo = BarNo + 1
ENDSCAN

nPopLine = 1

DEFINE WINDOW test ;
	AT 0.000, 0.000 ;
	SIZE 21.769,147.800 ;
	FONT &quot;MS Sans Serif&quot;, 8 ;
	FLOAT ;
	CLOSE ;
	NOMINIMIZE ;
	SYSTEM

ACTIVATE WINDOW test

@ 18.462,43.200 GET oCommand ;
	PICTURE &quot;@*HT \<Exit&quot; ;
	SIZE 1.769,6.500,0.667 ;
	DEFAULT 1 ;
	FONT &quot;MS Sans Serif&quot;, 8 ;
	STYLE &quot;B&quot;

@ 5.077,9.800 GET nPopLine ;
	PICTURE &quot;@&N&quot; ;
	POPUP PopName ;
	SIZE 13.000,87.429 ;
	DEFAULT &quot; &quot; ;
	FONT &quot;FoxFont&quot;, 7 ;
	STYLE &quot;&quot; ;
	VALID MarkPop(nPopLine)

READ CYCLE

PROCEDURE MarkPop
	PARAMETERS nBar
	SET MARK OF BAR nBar OF &quot;PopName&quot; TO ;
                    NOT (MRKBAR(&quot;PopName&quot;,nBar))
	RETURN .T.
[\code]
 
Checking LASTKEY() after a mouse will still register the last key pressed, not a mouse click.
Try this old procedure for your mouse double clicks. It will simulate a double click for older versions of Fox. Put the first section at top of .prg, and the procedure where your other one is:

Code:
_DBLCLICK = .25
STORE SECONDS() TO m.m_timeout
STORE .F. TO doubleclicked
ON KEY LABEL leftmouse DO mhandler


PROCEDURE mhandler
   
   IF SECONDS() < m.m_timeout
      =INKEY(0, 'HM')
      IF MWINDOW() # WONTOP() .OR. MROW() < 0
         KEYBOARD(&quot;{ESCAPE}&quot;)
      ELSE
         doubleclicked = .T.
         KEYBOARD(&quot;{ENTER}&quot;)
      ENDIF ( MWINDOW() # WONTOP() .OR. MROW() < 0 )
   ELSE
      STORE SECONDS()+_DBLCLICK TO m.m_timeout
   ENDIF ( SECONDS() < m.m_timeout )
   RETURN


-Dave S.-
[cheers]
Even more Fox stuff at:
 
Dave; Thanks again!

It's not that the mouse isn't recognised - a double-blip *is* recognised, the VALID fires and a check mark is placed in the MARGIN. If you then press down-arrow to select a second entry and hit return there will be two marks in the MARGIN.

However, if instead of pressing down-arrow and hitting return you blip on another entry just ONCE, all previous marks in the MARGIN disappear. In this instance the VALID does *not* fire.

Baffling, eh?

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top