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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MOUSEENTER and Wait Window NOCLEAR

Status
Not open for further replies.

Kruno

Programmer
Aug 24, 2002
16
0
0
WAIT WINDOW is used mostly with TIMEOUT or NOWAIT clause. I have never used NOCLEAR clause before.

When user selects an item from listbox (e.g. filled with filenames), before he clicks on commandbutton to do something with it, I want to show him what he selected and what will happen after clicking.

Wait window and commandbutton's MOUSEENTER method will serve to show such dynamic message.

Case #1: WAIT WINDOW sometext NOWAIT and "sometext" will show shortly and dissapear while you are continuing to move mouse over commandbutton's pixels.

Case #2: using NOCLEAR clause will make "sometext" staying visible while you are moving your mouse. To switch off showing "sometext" you put WAIT CLEAR in MOUSELEAVE method. But when you enter with mouse again, wait window does not show anymore!

Case #3: The trick is to add WAIT WINDOW '' TIMEOUT 0.001. Yes, NOCLEAR is nice feature but needs CLEAR + TIMEOUT to work properly. Unfortunately when you decide to click the commandbutton you need two clicks !

Case #4: To solve this new problem you have to add TIMEOUT 0.001 after NOCLEAR (e.g.WAIT WINDOW sometext NOCLEAR TIMEOUT 0.001). You will need just one click to activate commandbutton and "sometext" will show properly everytime you enter with mouse over commandbutton.

Kruno Malovic

Code:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 53, ;
		Left = 150, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Case #1", ;
		Name = "Command1"

	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 98, ;
		Left = 150, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Case #2", ;
		Name = "Command2"

	ADD OBJECT command3 AS commandbutton WITH ;
		Top = 143, ;
		Left = 150, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Case #3", ;
		Name = "Command3"

	ADD OBJECT command4 AS commandbutton WITH ;
		Top = 187, ;
		Left = 150, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Case #4", ;
		Name = "Command4"

	PROCEDURE command1.MouseEnter
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT WINDOW TRANSFORM(TIME()) NOWAIT
	ENDPROC

	PROCEDURE command1.Click
		WAIT WINDOW 'Done !' TIMEOUT 1
	ENDPROC

	PROCEDURE command2.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT clear
	ENDPROC

	PROCEDURE command2.Click
		WAIT WINDOW 'Done !' TIMEOUT 1
	ENDPROC

	PROCEDURE command2.MouseEnter
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT WINDOW TRANSFORM(TIME()) noclear
	ENDPROC

	PROCEDURE command3.MouseEnter
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT WINDOW TRANSFORM(TIME()) NOCLEAR
	ENDPROC

	PROCEDURE command3.Click
		WAIT WINDOW 'Done !' TIMEOUT 1
	ENDPROC

	PROCEDURE command3.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT clear
		WAIT WINDOW '' TIMEOUT 0.001
	ENDPROC

	PROCEDURE command4.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT clear
		WAIT WINDOW '' TIMEOUT 0.001
	ENDPROC

	PROCEDURE command4.Click
		WAIT WINDOW 'Done !' TIMEOUT 1
	ENDPROC

	PROCEDURE command4.MouseEnter
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT WINDOW TRANSFORM(TIME()) NOCLEAR TIMEOUT 0.001
	ENDPROC

ENDDEFINE
 
wouldn't ToolTipText and/or StatusBarText help you to achive the same information?

Especially StatusBarText will show instantly if seom control get's focus and tooltiptext will appear after a timeout. You could simply change from using WAIT WINDOW to using MESSAGE to have more individual status bar messages eg for an item of a listbox.

Also you can lower the _tooltiptimeout to 0 to make tooltip texts appear instantly.

Bye, Olaf.



 
Hi Kruno,

A Wait window isn't a good interface for this. It's too far away from the focus of the user's attention (and it's not easy to place it at a specific position relative to the form). Also, as you have found, it either disappears almost immediately, or the user how to dismiss it, and it's not obvious how to do that.

Personally, I would display the information on the form, right next to the listbox. You could show it in one or more label, which you can update in the listbox's InteractiveChange. That way, the user will see it immediately, as they are navigating the listbox, and it will do no harm for it to stay on the screen until they navigate to somewhere else.

Olaf's suggestion for using the status bar is also good, but, like the Wait window, the status bar might not be near where the user is focusing their attention.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Olaf,

I agree with Mike - STATUS BAR is too far away from the control the user is intended to click (a commanbutton near listbox).
I tried TOOLTIP. Yes, more prettier than WAIT WINDOW, more closer to commandbutton, but too slow showing.
Various _TOOLTIPTIMEOUT settings do nothing with speed of appearance. Try different settings in my sample and see the slowness.

Bye, Kruno
Code:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	DoCreate = .T.
	ShowTips = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT optiongroup1 AS optiongroup WITH ;
		ButtonCount = 3, ;
		Value = 1, ;
		Height = 67, ;
		Left = 104, ;
		Top = 46, ;
		Width = 71, ;
		Name = "Optiongroup1", ;
		Option1.Alignment = 2, ;
		Option1.Caption = "-1", ;
		Option1.Value = 1, ;
		Option1.Height = 17, ;
		Option1.Left = 5, ;
		Option1.Top = 5, ;
		Option1.Width = 61, ;
		Option1.Name = "Option1", ;
		Option2.Alignment = 2, ;
		Option2.Caption = "0", ;
		Option2.Height = 17, ;
		Option2.Left = 5, ;
		Option2.Top = 24, ;
		Option2.Width = 61, ;
		Option2.Name = "Option2", ;
		Option3.Alignment = 2, ;
		Option3.Caption = ">0", ;
		Option3.Height = 17, ;
		Option3.Left = 5, ;
		Option3.Top = 43, ;
		Option3.Width = 61, ;
		Option3.Name = "Option3"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 125, ;
		Left = 93, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Tooltip", ;
		ToolTipText = (transform(time())), ;
		Name = "Command1"

	ADD OBJECT command4 AS commandbutton WITH ;
		Top = 125, ;
		Left = 212, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Case #4", ;
		Name = "Command4"

	PROCEDURE optiongroup1.Valid
		DO case
		CASE this.Value=1
			_tooltiptimeout=-1
		CASE this.Value=2
			_tooltiptimeout=0
		CASE this.Value=3
			_tooltiptimeout=0.001
		endcase
	ENDPROC

	PROCEDURE command1.Click
		WAIT WINDOW 'Done !' TIMEOUT 1
	ENDPROC

	PROCEDURE command4.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT clear
		WAIT WINDOW '' TIMEOUT 0.001
	ENDPROC

	PROCEDURE command4.Click
		WAIT WINDOW 'Done !' TIMEOUT 1
	ENDPROC

	PROCEDURE command4.MouseEnter
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT WINDOW TRANSFORM(TIME()) NOCLEAR TIMEOUT 0.001
	ENDPROC

ENDDEFINE
 
Hi Mike,

Yes, not so easy to place WAIT WINDOW near commandbutton which is to be clicked. Thanks to NOCLEAR clause WAIT WINDOW does not disappear. Did you try my first sample ?

I simplified my problem and maybe mislead you. The point is not in listbox, but in commandbutton:
The user chooses SOURCE and DESTINATION folders via two listboxes (classic: dblclick to dive to subfolder, dblclick on .. to go up, select).
When the user set both sides/lisboxes, he may click on a button to start copying or moving.
Clicking on button is critical operation. There is no UNDO. So I wanted TOOLTIP to pop up when the user enters mouse over commandbutton - before he clicks it.
TOOLTIP should show him WHICH folders/files are to be copied/moved FROM and WHERE TO. This depends on user in runtime. To simulate this dynamicness I showed TIME() in my sample, not some static text.
I display what the user has selected from listoboxes to get full picture (i.e.full path). This way he can be sure what will happen after clicking.

TOOLTIP is slow (see my sample for Olaf). So I use WAIT WINDOW with the clause I never used before (NOCLEAR) and wanted to share my experience.
Of course, many developers, many GUI preferences and solutions.

And you made me think about position of WAIT WINDOW. If the user is used to default position of WAIT WINDOW, then nothing to wary about - Case #4 is the solution.

The case #5 in my new sample resolves the issue of positioning the WAIT WINDOW depending on control. Try it.
Credits to author (Sergey?) of FOX2PIX function and stuff in MouseEnter from site:
Kruno

Code:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 103, ;
		Left = 144, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Case #5", ;
		Name = "Command2"

	PROCEDURE pix2fox
		LPARAMETER tnPixels, tlVertical, tcFontName, tnFontSize
		&& tnPixels - pixels to convert
		&& tlVertical - .F./.T. convert horizontal/vertical coordinates
		&& tcFontName, tnFontSize - use specified font/size 
		&&         or current form (active output window) font/size, if not specified 
		LOCAL lnFoxels
		 
		IF PCOUNT() > 2
			lnFoxels = tnPixels/FONTMETRIC(IIF(tlVertical, 1, 6), tcFontName, tnFontSize)
		ELSE
			lnFoxels = tnPixels/FONTMETRIC(IIF(tlVertical, 1, 6))
		ENDIF
		 
		RETURN lnFoxels
	ENDPROC

	PROCEDURE command2.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT clear
		WAIT WINDOW '' TIMEOUT 0.001
	ENDPROC

	PROCEDURE command2.Click
		WAIT WINDOW 'Done !' TIMEOUT 1
	ENDPROC

	PROCEDURE command2.MouseEnter
		LPARAMETERS nButton, nShift, nXCoord, nYCoord

		LOCAL lnPosX, lnPosY, lnRow, lnCol
		 
		&& Position a WAIT WINDOW menu at the bottom-right corner of the button
		lnPosY = _screen.Top + Thisform.Top + SYSMETRIC(4) + SYSMETRIC(9) + This.Top + This.Height
		lnPosX = Thisform.Left + SYSMETRIC(3) + SYSMETRIC(12) + This.Left + This.Width
		 
		lnRow = thisform.pix2fox(lnPosY, .T.,_screen.Fontname ,_screen.FontSize)
		lnCol = thisform.pix2fox(lnPosX, .F.,_screen.Fontname ,_screen.FontSize)

		WAIT WINDOW TRANSFORM(TIME()) AT (lnRow), (lnCol) NOCLEAR TIMEOUT 0.001
	ENDPROC

ENDDEFINE
 
You both argue about the statusbar text position, but that is one standard position of windos applications showing messagtes, hints, tipps, etc. If someone isn't used to watch the status bar, it's an unexperienced Windows user. The more specific GUIs are used, the better each GUI may be adopted to the app, but users might only accpet differences where they are neede and/or fancier than the normal stuff.

I agree that as you can't UNDO a copy operation, an instantly appearing wait window could be applied, regarding windows standards I'd use a Messagebox with YES/NO, eg "Will now COPY Source TO Dest. Are you sure? Y/N". Although that can be annying it's important enough that a confirmation is acceptable. You can use a lightbox technique (as Vista does to ask for install confirmations) to get the user's attention:
Sorry, that I don't show the enthusiasm you deserve for finding out some special ways with WAIT WINDOW. You have a valid scenario and it may be preferred by others for it's simplicity and effectiveness without the extra annoyance of asking for an extra click.

Bye, Olaf.
 
Kruno,

I really think you're making this more complicated than it need be.

If I understand it right, you're now saying your goal is to give the user a confirmation of the copy file operation they are about to perform. And because the operation cannot be undone, you want to be sure they see it (for the same reason, you should also force them to acknowledge it).

If that's right, surely the best solution is to display a messagebox from the button's Click. The message will spell out exactly what the user is about to do. If they click OK, it goes ahead with the copying. If they click Cancel, it doesn't.

If I've misunderstood what you are trying to achieve, then please clarify exactly what your goal is.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Olaf,

You both argue about the statusbar text position, but that is one standard position of windos applications showing messagtes, hints, tipps, etc. If someone isn't used to watch the status bar, it's an unexperienced Windows user.

I don't often disagree with you, but ....

I've nothing against using a status bar for explanatory messages and extra bits of information, but I don't think it's the right place for things that the user must see in order to carry out a task (which is the case that Kruno was describing, if I understood it right). Why force the user to shift their focus to another part of the screen, when they need to give their full attention to the task in hand?

Also, you say that a user who isn't watching the status bar is "unexperienced". That may be true, but that's no reason to make it harder for them.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top