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

Grid scroll

Status
Not open for further replies.

realshyfox

Programmer
Apr 9, 2009
7
ES
Is it posible to scroll the grid pressing the right button over it and drag down the cursor (without the need of the grid scrollbar)?
 
No. At MOST, pressing and dragging the mouse should cause drag/drop. Nothing more.
 
Hi

Just add to the query of realshyfox, I was also looking for the similar sorts of requirement. If I click on grid which is generated in InteractiveChange event of the textbox to find out any record it is performing lost focus event in which I made some calculations. What I want is if I place mouse pointer on grid it should scroll Up or down according to the direction of mouse pointer so the user can note that particular code as an input of that textbox.

Thanks

Saif
 
Saif,

if you want to use a list of items to pick from into a textbox, then use the combobox in drop down combo box style (which is the default).

If you combine more than one control to one control, then you have to live with "early" lostfocus, a your combination of controls is not one control. Then don't do the calculation in the control.

Bye, Olaf.
 
Olaf, is there any way to keep grid in focus till the user select the record and cursor move to the other control.
It is running very smoothly, display all records being searched by text box input, only problem occurs when the user click on grid and control goes to lost focus event. I can manage it also if I get any clue to move the records up and down by placing the mouse pointer on to it.

Thanks

Saif
 
I already said elsewhere you can't influence event order, you also can't influence events to happen. If you use two controls instead of one, you can't use lostfocus event in the hope it will only happen, when you need it. The lostfocus event of neither control is helping you here, so look for something else or create it yourself.

A hint: If you put both the textbox and the grid inside a container control, you can ensure both controls lost focus, if the container.lostfocus event runs.

Bye, Olaf.
 
On a form with a Grid

Grid MouseDown Event:

Code:
PUBLIC    cInitialnYCoord, TopDist, BottomDist, RSUp,RSDown

cInitialnYCoord = nYCoord

Grid MouseMove Event

Code:
IF nButton = 1

	IF nYCoord > cInitialnYCoord +18
		this.DoScroll(0) && scroll up
  	ENDIF
  	
	IF nYCoord = cInitialnYCoord
		RETURN
  	ENDIF
  	  	
 	IF nYCoord < cInitialnYCoord -18
 		this.DoScroll(1) && scroll down		
 	ENDIF
ENDIF

I know that I must work it but it´s just an ideea
 
Yes, I would think something like that would work.

But one very obvious improvement: get rid of the public variables. Instead, make them custom properties of your grid class. That's the whole point of custom properties: to make the control self-contained. If you use public properties, you introduce unnecessary dependencies. In particular, the whole thing will fail if you have more than one instance of the grid in your application.

Also, just out of curiosity: why do you want to do this? Why is this better than having the user use the scroll wheel or the scrollbars? After all, that's what they would expect to do in other applications.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I tried in my case but not working. Is there anything to keep in mind.

Thanks

Saif
 
Mike said:
Yes, I would think something like that would work.

But one very obvious improvement: get rid of the public variables. Instead, make them custom properties of your grid class. That's the whole point of custom properties: to make the control self-contained. If you use public properties, you introduce unnecessary dependencies. In particular, the whole thing will fail if you have more than one instance of the grid in your application.

Yes, you´re right. This was just a concept, cause now I´m workin´ on other proj. I shall come back with a class.

Mike said:
Also, just out of curiosity: why do you want to do this? Why is this better than having the user use the scroll wheel or the scrollbars? After all, that's what they would expect to do in other applications.

I must make the app W8 tablet ready. When I´ll have more time I´ll take a look at the multi-touch messages and implent them in VFP but till then ... this will do it [smile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top