Source language: Translate to:

Cursor Position within a inputbox

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Cursor Position within a inputbox

Postby David de Argentina » Fri Jan 19, 2007 1:47 pm

Hi all,

I need display some text.
Text is permanently updating. I use a input box object because scroll bars allows to display this text sequencially.

each time i refresh the object, cursor position return to the oldest text, and the vertical scroll bar is reseted to the top position.

Are there any way to set the cursor position at the last (newest text) and the vertical scroll bar at the bottom position?

Any ideas?

Thanks in advance,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby Gaev » Fri Jan 19, 2007 2:20 pm

David de Argentina:

Normally, you can do what you want using GetObjectInfo "CursorPosition" and then repositioning the cursor using SendKeys with {Home} and multiple {Right} parameters ... but I find that it does not work as expected when the text wraps past the first line ... and Cursor is located on other than this first line.
Any Ideas ?
Have you considered using a Browser Object instead ... and build the text dynamically using BrowserLoadFromStr ... using a template in which you StrReplace something like "asdjkjb'el;kjlhk" with the new text each time ... you can get and set scrollbar positions with javascript/dhtml.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby David de Argentina » Fri Jan 19, 2007 2:42 pm

Thanks Gaev,
Good idea,

Build dinamicaly a HTML allow to use more posibilities: Colors, fonts, sizes, etc...

And i can put each time a markup flag at each newest text... and call it using BrowserGoto "Webbrowser1" "mytext.htm#mylastflag" ... or some like this...


Thanks again !
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby Gaev » Fri Jan 19, 2007 6:54 pm

David de Argentina:
And i can put each time a markup flag at each newest text... and call it using BrowserGoto "Webbrowser1" "mytext.htm#mylastflag" ... or some like this...
... or you could look into the scrollTop property ... from MSDN ...
Sets or retrieves the distance between the top of the object and the topmost portion of the content currently visible in the window.

[ iDistance = ] object.scrollTop

iDistance Integer that specifies or receives the distance, in pixels.
... where object can be the body element ... and you can retrieve this value just before you replace the content ... and set it to this value afterwards.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby David de Argentina » Tue Jan 23, 2007 2:28 pm

David de Argentina wrote:And i can put each time a markup flag at each newest text... and call it using BrowserGoto "Webbrowser1" "mytext.htm#mylastflag" ... or some like this...


I built a sample using this method, and works fantastic !!!

Cheers,

David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby David de Argentina » Thu Jan 25, 2007 11:41 am

Hi Gaev,

I upload a fully featured sample on this link:

http://www.specialapps.software-zone.com/files/chat.zip

sample needs NBPlay 5.5.3

You can test it at one pc, changing the local and remote port to the same value. eg. 18000.

Cheers,

David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests