Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > VB Classic

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 01-26-2005, 02:07 PM
vbdude vbdude is offline
Registered User
 
Join Date: Jan 2005
Location: USA
Posts: 87
Question VB MultiPage Focus problem

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
Reply With Quote
  #2  
Old 01-31-2005, 01:17 PM
vbdude vbdude is offline
Registered User
 
Join Date: Jan 2005
Location: USA
Posts: 87
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.
Reply With Quote
  #3  
Old 01-31-2005, 03:38 PM
brhsolutions brhsolutions is offline
Registered User
 
Join Date: Jan 2005
Posts: 16
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
Reply With Quote
  #4  
Old 01-31-2005, 04:03 PM
vbdude vbdude is offline
Registered User
 
Join Date: Jan 2005
Location: USA
Posts: 87
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.
Reply With Quote
  #5  
Old 01-31-2005, 06:17 PM
brhsolutions brhsolutions is offline
Registered User
 
Join Date: Jan 2005
Posts: 16
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
Reply With Quote
  #6  
Old 02-01-2005, 02:49 PM
vbdude vbdude is offline
Registered User
 
Join Date: Jan 2005
Location: USA
Posts: 87
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.)
Reply With Quote
  #7  
Old 02-02-2005, 10:41 AM
vbdude vbdude is offline
Registered User
 
Join Date: Jan 2005
Location: USA
Posts: 87
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
Reply With Quote
  #8  
Old 02-02-2005, 11:47 AM
brhsolutions brhsolutions is offline
Registered User
 
Join Date: Jan 2005
Posts: 16
Try his web site it has a bug Excel

http://www.dicks-blog.com/archives/2...trols-on-2003/

I would try this but not sure.
__________________
BRHsolutions Team
Reply With Quote
  #9  
Old 02-02-2005, 05:46 PM
vbdude vbdude is offline
Registered User
 
Join Date: Jan 2005
Location: USA
Posts: 87
Unhappy

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
Attached Files
File Type: zip multipage.zip (1.3 KB, 78 views)
Reply With Quote
  #10  
Old 02-02-2005, 06:32 PM
mstraf's Avatar
mstraf mstraf is offline
Senior Member
 
Join Date: Nov 2003
Location: Alameda, CA
Posts: 1,648
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
Reply With Quote
  #11  
Old 02-02-2005, 06:39 PM
brhsolutions brhsolutions is offline
Registered User
 
Join Date: Jan 2005
Posts: 16
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
Reply With Quote
  #12  
Old 02-03-2005, 10:22 AM
svasile svasile is offline
Registered User
 
Join Date: Feb 2005
Posts: 1
Use GotFocus

Use the GotFocus event instead of the Click.
Reply With Quote
  #13  
Old 02-04-2005, 10:23 AM
vbdude vbdude is offline
Registered User
 
Join Date: Jan 2005
Location: USA
Posts: 87
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.
Reply With Quote
  #14  
Old 02-04-2005, 11:56 AM
Anklebuster's Avatar
Anklebuster Anklebuster is offline
Registered User
 
Join Date: Oct 2004
Posts: 51
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
edit... You don't even need a frame! put the MultiPage1.SetFocus in your form's MosueMove event. I like the frame because you can move everything around at once.

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
Attached Files
File Type: zip multipage.zip (2.7 KB, 68 views)

Last edited by Anklebuster; 02-04-2005 at 12:03 PM.
Reply With Quote
  #15  
Old 02-04-2005, 03:03 PM
mstraf's Avatar
mstraf mstraf is offline
Senior Member
 
Join Date: Nov 2003
Location: Alameda, CA
Posts: 1,648
Quote:
Originally posted by Anklebuster
put the MultiPage1.SetFocus in your form's MosueMove event.
Although this method works, it has a big problem. I click the text box to start edit then I move the mouse away: say hello to editing, the focus is lost. And more. Let's say I am editing a text box (or anything else in the form) and I move the mouse: bingo, the mutlipage gets the focus and I cannot edit anymore. Also I cannot select the all text by dragging the mouse unless I keep the mouse within the box: as soon as the mouse is outside the box, the multipage again get the focus.

Nice idea though. Maybe with some more twicking. But in my experience and IMHO, messing with the focus causes always trouble...

Marco
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 01:57 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.