realbasic-nug
[Top] [All Lists]

MultiLine Tabbing RB Win 5.5.

To: realbasic-nug at lists dot realsoftware dot com
Subject: MultiLine Tabbing RB Win 5.5.
From: "Duane Hennessy" <duaneh at connexus dot net dot au>
Date: Mon, 4 Oct 2004 10:17:00 +1100
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Xantivirus: This e-mail has been scanned for viruses via the Connexus Internet Service
Does anyone have a formula for multiline tabbing that doesn't bounce the edit 
field up and down.

I tried Regex text replacement which replaced the entire selected lines of 
text but as I tab further down the text the editfield text jumps like a 
Wallaby every time I tab. So I changed my formula to the following:


  dim Counter, i, iScrollPosition as Integer
  
  // set Scroll Position
  CodeSnippetText.ScrollPosition=iScrollPosition
  
  // set selection
  SetMultiLineTabSelection
  
  // add tabs to each line
  for Counter=firstSelectionLine to lastSelectionLine
    i=CodeSnippetText.CharPosAtLineNum(Counter)
    i=i-1 // to put the cursor before the first character in the line for 
tabbing in front of
    CodeSnippetText.SelLength=0
    CodeSnippetText.SelStart=i
    CodeSnippetText.SelText=chr(9)
  next
  
  // get Scroll Position
  iScrollPosition=CodeSnippetText.ScrollPosition
  
  // set selection
  SetMultiLineTabSelection

-!!! SetMultiLineTabSelection (method) - Just selects the entire area from 
the beginning of the first line to the end of the last line.

Iterating through the lines I just add chr(9) to the beginning of each one. I 
still get a jumping effect but not as drastic as the Regex replace text 
version I had. I think the selection of the text or the adding of the text 
causes the EditField to set its selection to first character of the first 
line of all of the text in the EditField and the scrollposition then returns 
it to where it was making it look like it is jumping. It's annoying to say 
the least.

Any code or ideas would be appreciated.

tia

Duane Hennessy
Tropical Queensland, Australia.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>
  • MultiLine Tabbing RB Win 5.5., Duane Hennessy <=