|
#1
|
|||
|
|||
|
Hi
I have a MultiPage control on my form which has 4 pages (tabs). Each page has controls on it like textboxes, comboxes etc. When the current focus is inside a textbox/combobox on a tab, I have to click the another desired tab twice to select it. e.g. Current focus is in a textbox on tab 3. I want to select tab 4. The first click on the tab 4 gets the focus on Multipage control only. Now I have to click again on tab 4, to view its contents. What is the solution, so that i can get this done in a singe click?. vbdude |
|
#2
|
|||
|
|||
|
Hello
Can anyone provide help on this issue please? I am stuck here. And the users are getting really annoyed by having to click twice to get into the tab. Thanks. |
|
#3
|
|||
|
|||
|
OK, Let me make sure I'm understanding the issue. You have a tab control, and you are using the tab to show different forms. The controls you are attempting to see are not on the tab right.
If the above is true you need to control it via your code. I would bet your sub looks similar to this: Private Sub SSTab1_DblClick() Change it to this: Private Sub SSTab1_Click(PreviousTab As Integer) Tabs are strange you have to double click on them to get to code view from GUI veiw. Next time swap to code view then select your control and the event at the top. I hope this helps. If not you should clarify you issue a bit more.
__________________
BRHsolutions Team |
|
#4
|
|||
|
|||
|
Thanks for the reply brhsolutions.
Ok. Let me re-word my problem. I have a MultiPage control on my form which has 3 pages (This is different from the Tab control, but looks exactly similar) Each "page" (tab) has a frame on it. So page 1 has frame 1 on it, page 2 has frame 2 on it page 3 has frame 3 on it. Frames are used to hold all the related controls (textboxes,label,combos etc) together. A click on the pages (or tabs) on top of this Multipage control generates the following event: Private Sub mPage_change() If mPage.Value = 0 Then Frame1.Visible = True End if If mPage.Value = 1 Then Frame2.Visible = True End if If mPage.Value = 2 Then Frame3.Visible = True End if End Sub Now here is the problem: If user selects page 1. The corresponding frame becomes visible and the user starts typing in a textbox on that frame. The cursor/focus is in the textbox. Now the user decides to change the page (tab). The first click by user just selects (gets focus on) the "MultiPage Control". The user has to click once more to actually initiate the mPage_change() event. The user gets annoyed when he clicks the tabs on the top for the first time and nothing happens. Is there any way we can get the "focus" and "change" event both done in single user click? Thanks. |
|
#5
|
|||
|
|||
|
This control also has a click event
Change the Private Sub mPage_change() to Private Sub mPage_Click(Index As Long) I built a small app to simulate the code you had below and it you use change you must double click if you use click it works for me with single.
__________________
BRHsolutions Team |
|
#6
|
|||
|
|||
|
Yes, I tried with
Private Sub mPage_Click(Index As Long) But it still needs 2 clicks I am on page 2. Page 2 has a frame on it. My focus is inside a textbox on that frame. Now I click on the Page(tab) 4. First click selects the mPage control only. I checked this in debug mode. The first click does not generate any event. The second click generates mPage_Click event. Need Help. Thanks (note: The MultiPage control is on a form, and has 4 pages.) |
|
#7
|
|||
|
|||
|
Hello Everyone
Need help. Am I not explaining the problem properly? Need to fix this bug asap in my application, and release it to client. Thanks |
|
#8
|
|||
|
|||
|
Try his web site it has a bug Excel
__________________
BRHsolutions Team |
|
#9
|
|||
|
|||
|
I have attached the form here.
click inside textbox1 (on frame1) and type anything Then click pag2 tab.......nothing happens. Needs one more click to activate the change event on MultiPage Please help. Thanks NOTE: Add Components: Microsoft Forms 2.0 Object Library |
|
#10
|
||||
|
||||
|
The MultiPage control is a bad beast, and MS does not support it anymore. Basically the first click switch the focus to the page, and the second sends the Click event. Any reason why not to use the TabStrip control (there is a version of it in the Forms 2.0 library)
The index of the selected tab strip item is: tabstrip.selecteditem.index and it starts from 1 (if I remember correctly) Marco |
|
#11
|
|||
|
|||
|
I tested and it works the way you said.
This is a a bandaid but what you could do is set a varible say test1 to 1 if text box one is changed then to 2 if text 2 is changed. then instead of monitoring the value of the multipage monitor the value of this varible. I did not test very much but this looks as if it works. You would have to besure the on form load was set right and that if no data was changed it shows the right data. Hope this helps. it is a bit hooky but it is the only way I could get it to work right. Private Sub MultiPage1_Change() If test1 = 1 Then Frame2.Visible = True Frame1.Visible = False MultiPage1.Value = 1 test2 = 0 test1 = 0 ElseIf test1 = 2 Then Frame1.Visible = True Frame2.Visible = False MultiPage1.Value = 0 test2 = 0 test1 = 0 Else If MultiPage1.Value = 1 Then Frame1.Visible = True Frame2.Visible = False End If If MultiPage1.Value = 0 Then Frame2.Visible = True Frame1.Visible = False End If End If End Sub Private Sub Text1_Change() test1 = 1 End Sub Private Sub Text2_Change() test1 = 2 End Sub
__________________
BRHsolutions Team |
|
#12
|
|||
|
|||
|
Use GotFocus
Use the GotFocus event instead of the Click.
|
|
#13
|
|||
|
|||
|
Thanks for the replay everyone.
Mr. Marco Unfortunately it will be difficult to change MultiPage to Tabstrip, since the application is already being used now. I wish I would have known this in the beginning. But appreciate your help. brhsolutions The MultiPage1_Change() event itself needs 2 clicks to get fired. svasile Yes, I tried using the Gotfocus event. But surprisingly, the event is Not fired with the "first click" when the MultiPage controls gets into focus. Also, even if that worked, how can i catch the index of tab that was clicked? Thank You. |
|
#14
|
||||
|
||||
|
Eureka!
vbDude, if you can place the multipage and each of the frames inside of another frame - which I'll call wrapper -, all you'll need is a single line of code ! Code:
Private Sub fraWrapper_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MultiPage1.SetFocus
End Sub
I downloaded your project example and added the wrapper. The trick is to have space between the tab and the frames. Important notes: the multi-page was not present or would not load from the zip, so i just dropped another one on the form, so I have no idea if this solution can be tailored to your application. I just know it works. In addition, while testing, I wanted to see if the textbox was a specific issue, so I added a non-functioning command button to each frame. As you know, as long as no other control has the focus, multipage works as you want it to. Anklebuster Last edited by Anklebuster; 02-04-2005 at 12:03 PM. |
|
#15
|
||||
|
||||
|
Quote:
Nice idea though. Maybe with some more twicking. But in my experience and IMHO, messing with the focus causes always trouble... Marco |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|