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

Blinking Scrollbar Problem

Status
Not open for further replies.

craigsboyd

IS-IT--Management
Nov 9, 2002
2,839
US
I am using the Forms.Scrollbar.1 control (Microsoft Forms 2.0 Scrollbar) - it blinks (the little slider bar does) when it gets the focus and won't stop no matter what I do. I have read countless articles that suggest that I should quite simply just set TabStop to .F. and the blinking will go away, well that might work for VB but not for this scrollbar. I have it in a container but I don't think that's related since the blinking is built into the control. Obviously some software guru up at Microsoft thought it would be neat if the scrollbar blinked, but I find it is anything but. So anyways, maybe someone has conquered this particular problem in the past so I thought it worth my time to post. Thank you for your time and any efforts on my behalf. I will be sitting here watching the little blinking scrollbar mock my feeble attempts at making it stop until a solution is found.

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Here's some code that reproduces the problem. You will note that the scrollbar does not blink when it doesn't have the focus, but I am trying to make it not blink at all. Is it possible?

Code:
PUBLIC oForm
oForm = CREATEOBJECT("clsBlinkBlinkblink")
oForm.show()

DEFINE CLASS clsblinkblinkblink AS form


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


	ADD OBJECT olecontrol1 AS olecontrol WITH ;
		Top = 36, ;
		Left = 156, ;
		Height = 100, ;
		Width = 24, ;
		OleClass = "Forms.Scrollbar.1", ;
		Name = "Olecontrol1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 204, ;
		Left = 276, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Exit", ;
		Name = "Command1"


	PROCEDURE command1.Click
		Thisform.Release()
	ENDPROC


ENDDEFINE

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Although the scrollbar blinks when I run your code, hitting tab to move the focus to the exit button stops the scrollbar from blinking. I tried adding
Code:
FUNCTION olecontrol1.click
   DODEFAULT()
   thisform.command1.setfocus()
ENDFUNC
but that's not moving the focus. I haven't used the scrollbar ActiveX control before. What event fires when you click on it?


-BP (Barbara Peisch)
 
there are two events...Change and Scroll I believe...I am not looking at it right now so that is an educated guess as to the names of the events. Change fires when you click on the buttons or on the scroll bar itself...and Scroll fires when you move the slider button. It certainly is a frustrating "feature"...someone at MS needs a good flogging. i have ripped it out for now and I am using a VFP spinner and faking it, but I really want that scrollbar or I wouldn't fuss so much.

I tried setting focus away from it a few different ways but still that blink would be there...and another thing, setting focus in order to work around the problem is poor in situations where you don't necessarily have another control that can take focus...I guess there is always a hidden/transparent control and setting off the cursor with Set Cursor Off or something. I don't know, the thing has me whipped right now.

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
My thoughts have been leaning towards the fact that there must be a message being sent to the window (scrollbar) that tells it to turn itself off when the focus is set somewhere else...so maybe I need to spy on the message queue and see exactly what that message is and perhaps I can reproduce it using an API call. That is unless the scrollbar window is polling every second (or whatever) to see if it has focus in order to determine whether or not to blink...then my idea wouldn't work.

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Well according to SPY++ the messages are an initial hittest (when it is getting focus) and then a series of paints and background erases as it blinks and then a lost focus...

Anyways...looks like the focus is the actual trigger and not something else. I may try sending a few messages to that scrollbar...for those interested here is the necessary VFP Declare and Constants...
Code:
DEFINE WM_NCHITTEST                 0x84
DEFINE WM_PAINT                     0xF
DEFINE WM_ERASEBKGND                 0x14
DEFINE WM_KILLFOCUS                 0x8

DECLARE INTEGER SendMessage IN user32; 
    INTEGER hWnd,; 
    INTEGER Msg,; 
    INTEGER wParam,; 
    INTEGER lParam

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top