I am designing an editor program using rich text box in vb 6.0. I want to add a special box for entering verse or poems so that when I click a button, this box is placed at current position of cursor e-g if cursor is at line#3, the box is placed at line#3 and focus is changed from rtb to box. And after entering text in this box, when i click rtb, focus is changed from box to rtb, also cursor is placed below this box. Also I want that when I save the document, this box is also saved with. I have tried adding text box to accomplish these tasks but i am having problem setting position of textbox, setting focus and position of cursor. Also I dont think it can be saved with document. Is there a way to accomplish this by adding some box to rtb?
Adding textbox to rtb in vb 6
Collapse
X
-
Are you asking about a floating textbox... This sounds pretty interesting. Can you break it down a bit?
I know SelText can set focus on a certain, designated text. I suspect you'll need to use that in your code. As far as movement, perhaps you can write a function to control position of the textbox, which would then allow you to move it.
If I see anything, I'll post ...
In a bit! -
Hi,
Try This Code:
[code=vb]
Dim MyStr As String
Dim TotRTF As String
Dim MyText As String
MyText = "MY TEXT BOX"
MyStr = "\par \trowd\trgaph10 8\trleft36\cell x1636\pard\intb l "
MyStr = MyStr & MyText & "\cell\row\pard \par"
With RTB
.SelText = Chr(&H80)
TotRTF = .TextRTF
TotRTF = Replace(.TextRT F, "\'80", MyStr)
.TextRTF = TotRTF
End With
[/code]
Regards
VeenaComment
-
Hi Veena, Sorry for late reply. I hav tried this code but its not working. I hav added this code to the menu entry "Add TextBox". When i click this menu item only a character is printed. Maybe i'm not using it correctly.
If I add a textbox is it possible to change its size using mouse at runtime? And can i save it with rtb document?Comment
-
Hi,
I Guess, it is not possible to change the size at runtime..
The Code works Perfect here..
It IS not an Actual TextBox,
A Single-Row-Single-Colmn-Table is being added to the exisiting RTB at the selected Cursor Position....
from the code, "cellx1636"
change 1636 to some other number top change the width..
Regards
VeenaComment
Comment