Results 1 to 6 of 6

Thread: Menu & Text question [RESOLVED!]

  1. #1

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253

    Menu & Text question [RESOLVED!]

    Ok, like in a text editor you can select bold etc from the menu. Thats ok, i can do that - im using RTF here is my code:

    VB Code:
    1. Private Sub mnuFormatBold_Click()
    2. On Error Resume Next
    3. 'Bolden text
    4. mnuFormatBold.Checked = Not mnuFormatBold.Checked
    5. txtMain.SelBold = mnuFormatBold.Checked
    6. txtMain.SelStart = Len(txtMain.Text)
    7. End Sub

    Anyway i want to be able to click on a piece of text and determine if the selected text is say bold or not. So if the highlighted text is bold, the menu is checked, otherwise it isnt. This is so the user can view the selected text and see what has been formatted from the menu. If you know what i mean. I tried something like;

    If txtMain.Sel = (i tried adding true, but obviously it needs text).

    So any ideas are highly appreciated.

    THANKS!
    Last edited by Madboy; Nov 13th, 2003 at 03:00 PM.

  2. #2

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    ***BUMP***

  3. #3
    Frenzied Member dis1411's Avatar
    Join Date
    Mar 2001
    Posts
    1,048
    VB Code:
    1. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     mnuBold.Checked = RichTextBox1.SelBold
    3. End Sub

  4. #4

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    Thanks, even though the code goes in the Text box routine, like so:

    VB Code:
    1. Private Sub txtMain_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    2. mnuFormatBold.Checked = txtMain.SelBold
    3. End Sub

    Thanks anyway for the code

  5. #5
    Frenzied Member dis1411's Avatar
    Join Date
    Mar 2001
    Posts
    1,048
    works either way, probly better to have it in form_mousemove tho

  6. #6

    Thread Starter
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    Yeah, but that would only trigger the code if the mouse is moved over the form. Which is bad considering the textbox covers all the form. Apart from the caption bar!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width