6 Replies - 3718 Views - Last Post: 21 January 2011 - 01:34 PM Rate Topic: -----

#1 The Architect 2.0   User is offline

  • D.I.C Regular

Reputation: 37
  • View blog
  • Posts: 351
  • Joined: 22-May 08

scrolling without scroll bars

Posted 20 January 2011 - 02:05 PM

i'm trying to position two text boxes side by side and i only want to enable a scrollbar on one. whenever i use the scrollbar, i want the scrolling to occur on BOTH textboxes. how does one go about doing this?

This post has been edited by The Architect 2.0: 20 January 2011 - 02:08 PM

Is This A Good Question/Topic? 0
  • +

Replies To: scrolling without scroll bars

#2 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6537
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: scrolling without scroll bars

Posted 20 January 2011 - 02:10 PM

Turn off the auto scroll bars.
Make buttons for your scrolling events (up down, left right)
Then when the user clicks the [left] button send changes to both of your text boxes at the same time.

Though I think the GUI would feel more normal if you enable the scroll bars on both boxes.
When one box scrolls, send that action to the other box as well. People are used to a certain looks from applications. If they don't see scroll bars on the boxes then there must not be anything to scroll through.
Was This Post Helpful? 0
  • +
  • -

#3 The Architect 2.0   User is offline

  • D.I.C Regular

Reputation: 37
  • View blog
  • Posts: 351
  • Joined: 22-May 08

Re: scrolling without scroll bars

Posted 20 January 2011 - 03:21 PM

maybe i should rephrase this...

how on earth do i tell a textbox to move down one line(i KNOW it can do this without having a scroll bar)?

and

how do i receive a scroll event from a scroll bar in a text box?
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6537
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: scrolling without scroll bars

Posted 20 January 2011 - 03:41 PM

There is no direct access to things like Scroll position in the .NET framework.
You'll have to do this via p/invoke.
http://www.codeproje...r_position.aspx
Was This Post Helpful? 0
  • +
  • -

#5 Core   User is offline

  • using System.Linq;
  • member icon

Reputation: 784
  • View blog
  • Posts: 5,101
  • Joined: 08-December 08

Re: scrolling without scroll bars

Posted 20 January 2011 - 11:58 PM

I wrote an article about this problem:
http://dotnet.dzone....ing-between-two

Interestingly enough, you have to intercept the message from WndProc and use SendMessage (WinApi, of course) to scroll the second (linked) text box to a specific number of lines.

@tlhIn'toq - that article is really outdated. SetScrollPos is no longer supported as a primary function and is considered to be a legacy element (available for backwards compatibility purposes). You should use SetScrollInfo for the task you are mentioning. Besides, SetScrollInfo (and SetScrollPos for that reason) only have an effect on the scroll bar instance in the container and not the content inside it.
Was This Post Helpful? 0
  • +
  • -

#6 The Architect 2.0   User is offline

  • D.I.C Regular

Reputation: 37
  • View blog
  • Posts: 351
  • Joined: 22-May 08

Re: scrolling without scroll bars

Posted 21 January 2011 - 12:24 PM

seriously?? win32 only?

thanks for the heads up Core.
Was This Post Helpful? 0
  • +
  • -

#7 Core   User is offline

  • using System.Linq;
  • member icon

Reputation: 784
  • View blog
  • Posts: 5,101
  • Joined: 08-December 08

Re: scrolling without scroll bars

Posted 21 January 2011 - 01:34 PM

Yes, there is no way you can do this in pure .NET - one way or another, it's going to be around Win32.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1