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

Cursor Position in EditBox / Scroll Bar issue

Status
Not open for further replies.

kazl

Programmer
Dec 9, 2002
68
GB
Hi Tek-Tips People

I hate to raise this issue again, but have read 30+ posts on EditBox and spent afternoon trying... so here it goes.

I have an EditBox, with a scrollbar, on a form and there is more text than can be displayed in the box. It must be possible to amend/insert text anywhere in the box.

The problem occurs when I click somewhere in the top of the text and then scroll[bar] down and click in the next portion of text.

The cursor moves on to a position further up in the text, maybe/not in relation to its original position. I then need to use the keyboard to move to the right place.

(If the first and second selected points are within one screen/display there is no problem.)

SO - I'm looking for a new solution. Can I detect whether the scrollbar was used (VFP6)? -If so, I could keyb some up/dnarrows to physically move the cursor in the text instead of only changing the EditBox display?

OR - has anybody overcome this in some other way?

Sorry if that's a bit longwinded.
I would be grateful of any pointers.

Kaz
 
Kaz,

Have you tried to put an assign method around the SelStart property and debug from there? Just an idea...

Volker/
 
Hi

The problem occurs when I position the cursor in the text, move further down the text with the scroll bar and then click at the end of the text.

The text scrolls back up and the cursor appears in the wrong place.

I've tested for this on the Editbox example in Solution.App and that doesn't misbehave. So I'm going to keep on trying.

Kaz

 
Hi Kaz,

I've just tried a simple form with nothing but an editbox in it and in the Form.Init() I set the editbox's value to FileToStr( somefile.txt ) which is too long to fit, thus, you've got to scroll. The editbox behaves exactly as it should.
I have SP 5 installed, might that be an issue in your case?

tc

Volker/
 
Thanks Volker and Dave for your responses

I started again with a new form and edit box and managed to get it working properly. Then I found the root of the problem. It was to do with the grid program that calls the form. When I select a record from the grid, there was a problem in the scrolling of the edit box, whether using READ EVENTS or Show(1) for the Form.

I used PUSH KEY and PUSH KEY CLEAR to save and clear all key assignments before the form is displayed with Show(1), then POP KEY after the form is released. The scrolling / cursor positioning within the EditBox is now working as it should.

Thank you for taking the time to look at this.

Kaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top