Results 1 to 2 of 2

Thread: Ok Got Two Questions...Involves Text And Menus

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    14

    Post

    Ok I was wodering in a richtextbox how would I go about trapping the tab key? When I hit tab it changes focus and I even tried richtextboxes little tab thing set it to false or true and it doesnt work so I tried to capture the keyascii for tab key convert it into spaces and then set keyascii to 0 but still no go .. I need some help here.

    Second question is I have a sub menu under documents and I want it to view the recent documents folder but I dunno how to get all the contents of a folder into an array or anything like that. If I could get some help on that thanks.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    1) You could Disable the TabStop Property of all Controls on the Form, this would Force the RTFBox to use Tabs as Indents, then Reenable the TabStops on the LostFocus Event, ie.
    Code:
    Private Sub RichTextBox1_GotFocus()
        Dim oCTRL As Control
        On Error Resume Next
        For Each oCTRL In Me
            oCTRL.TabStop = False
        Next
    End Sub
    
    Private Sub RichTextBox1_LostFocus()
        Dim oCTRL As Control
        On Error Resume Next
        For Each oCTRL In Me
            oCTRL.TabStop = True
        Next
    End Sub
    2) Create a SubMenuItem off of your Documents Menu Called; mnuDocs and set it's Caption to {No Documents}, set its Enabled Property to False and its Index Property to 0(Zero).
    Code:
    Private Sub Command1_Click()
        Dim sDir As String
        Dim iFile As Integer
        
        sDir = Dir("C:\Files\*.txt")
        While Len(sDir)
            If iFile Then Load mnuDocs(iFile)
            mnuDocs(iFile).Caption = sDir
            mnuDocs(iFile).Visible = True
            mnuDocs(iFile).Enabled = True
            iFile = iFile + 1
            sDir = Dir
        Wend
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


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