Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tabbing problems 1

Status
Not open for further replies.

ixian

Programmer
Jul 13, 2001
128
US
Hey all,

A have a RTF1 but when I type in it and try to tab. It tabs out on the various cmd buttons. How to set the tab with in the RTF1.

Aaron Fear is the mind killer!!!!!!
 
You must "visit" all controls and change the TabStop property to false even the RTF (I think). Then you have to set .SelTabs or intercept the TAB to supply blanks.
TabStopDisable False ' turn off
TabStopDisable True ' turn on

Code:
Private Sub TabStopEnable(blnEnable as boolean)
    Dim ctl as control
    For each ctl in Form.Controls
        on error resume next ' some do not have
            ctl.TabStop = blnEnable
        on error goto 0
    Next
End Sub
 
You can try this also...

Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 9 Then
RichTextBox1.SelText = vbTab
KeyCode = 0
End If

End Sub
 
I've just tested with 2 command buttons, 2 text boxes and a rich text box. The keydown event for the rich text box is fired when I hit the TAB key.
 
Is this VB6. Do the controls have .TabStop = True and .Enabled = True. If so, then mine is different. RTF keyDown would not fire until .TabStop for a CheckBox was set to false.
 
Yes, VB6 sp3. If I comment out all code in the KeyDown event, pressing TAB results in normal behaviour (setting focus to next control in tab order).
 
I am running VB6 SP5. I was on Win 95 at work until today, now Win 2000 pro and Win Me at home. Check this out. What you propise may work on Win 2000 but might not work if PDW is used to distribute older RichED32.DLL to Win 95, Win 98 ??? etc.


I believe there has been change since Win '95 because I HAD to disable Tab Stops BUT on Win 2000 I don't now. I'll see what it does at home. I distribute the '97 version to avoid causing problems by "upgrading" somebody when possibly ther software can't handle it. RICHED32.DLL from VB 6 is 171K 5/7/1998 while Win 2000 Pro Windows/System32 has RichEd.DLL 4K 12/7/1999.
DOC for VB 6 says
"KeyDown and KeyUp aren't invoked for:

The ENTER key if the form has a CommandButton control with the Default property set to True.


The ESC key if the form has a CommandButton control with the Cancel property set to True.


The TAB key. "
 
Jjames

thanks,

Aaron Fear is the mind killer!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top