Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TabStrip Client Area co-ordinates

Posted on 1998-10-12
11
Medium Priority
?
239 Views
Last Modified: 2013-12-26
I've got a simple TabStrip control on a basic form. It has 4 tabs. When the form is resized, the TabStrip control is resized to the Scale Width/Height of the form. Great so far. Now, I've got 4 Frames, in a collection. The idea is that I associate each Frame with a Tab, and hide/show it (and its contained controls) appropriately. This is all working wonderfully - the correct controls are getting displayed depending on the selected Tab.

My problem is that I can't properly size the Frame within the Tab. The Form itself has a ScaleMode of 1 (Twips), but when I watch the code execute, it appears that the sizes of the Frames (before I resize them and after) aren't getting set properly. For example, when the form is resized to (for example) 10000 x 10000 (twips, don't forget), the tab control ends up with sizes like 9885 x 9315, which is fair enough. But the tab control's client area shows a size of 201.75 x 181.45. Naturally, when I set the frames to this size, they look like crap. At first I thought that somehow the client area sizes were being reported in pixels, rather than twips (despite the fact that all controls are supposed to inherit the parent form's ScaleMode), but that's not right either. I put in the correction (* Screen.TwipsPerPixelX) and they were still to small - they looked about two thirds as big as they should have been. In case it helps, here's the entire subroutine on the form's resize:

Private Sub Form_Resize()
    tabMain.Left = frmMain.ScaleLeft
    tabMain.Top = frmMain.ScaleTop
    tabMain.Width = frmMain.ScaleWidth
    tabMain.Height = frmMain.ScaleHeight
    fraTab(tabMain.SelectedItem.Index).Left = tabMain.ClientLeft
    fraTab(tabMain.SelectedItem.Index).Top = tabMain.ClientTop
    fraTab(tabMain.SelectedItem.Index).Width = tabMain.ClientWidth
    fraTab(tabMain.SelectedItem.Index).Height = tabMain.ClientHeight
End Sub

The main Form is frmMain, the TabStrip is tabMain, and the collection of Frames is fraTab.

Any suggestions?
0
Comment
Question by:tofff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 

Author Comment

by:tofff
ID: 1487589
Edited text of question
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1487590
First some optimalisations:
with frmMain
  tabmain.move .scaleleft, .scaletop, .scalewidth, .scaleheight
end with

 With tabmain
   fraTab.Move .ClientLeft, .ClientTop, .ClientWidth, .ClientHeight
End With
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1487591
Most likely, the problem disappears when you remove the tabstrip and create it again.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 13

Expert Comment

by:Mirkwood
ID: 1487592
Oeps, I think I see it.
Do you create the form with new? set aform = newFrmMain.
In that case aForm and frmMain are two different instances and have a different size.
Change the code to the code  below:
    tabMain.Left = me.ScaleLeft
    tabMain.Top = me.ScaleTop
    tabMain.Width = me.ScaleWidth
    tabMain.Height = me.ScaleHeight
0
 

Author Comment

by:tofff
ID: 1487593
I don't create the form frmMain - it's the startup object of the application.
I changed the code from 'frmMain' to 'Me' anyway - it did not help.
I inserted the optimisations you suggested - they did not help (not that you expected them to).
I removed the TabStrip and created a new one - that did not help.

Any other suggestions?
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1487594
You didn't by accident create the tabstrip or one of the frames inside another frame?
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1487595
debug.assert fraTab(tabMain.SelectedItem.Index).container is me
0
 

Author Comment

by:tofff
ID: 1487596
No, nothing like that - but I have found the problem. I have VB5.0 installed, with SP2. There are two different files which give access to a TabStrip control - both Microsoft, and both installed by either VB5.0 or SP2 (as above). They are:
COMCTL32.OCX (version 5.01.4319)
FM20.DLL (version 2.01)

Both have VERY different implementations of the same control. I was using the one from FM20.DLL - and, by my best estimation, it doesn;t work. The one in COMCTL32.OCX works fine with my existing code.

Thanks for your help, and why the hell did MSoft put out two different versions of the same control (they even have different parameter lists and orders for some methods!)
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1487597
FM20.dll is installed by VBA and Office.
You can ask at Customer Services to refund your points since you found the answer yourself.
0
 
LVL 3

Expert Comment

by:TheAnswerMan
ID: 1487598
or, you can give the points to me..
a poor lowly down on his luck expert <tin cup out>
0
 
LVL 7

Accepted Solution

by:
linda101698 earned 570 total points
ID: 1487599
I am posting the solution found by so it can be saved in the previously asked questions.  Please see your customer service question for an explanation.

Linda Gardner
Customer Service @ Experts Exchange

Solution:
 I have found the problem. I have VB5.0 installed,
     with SP2. There are two different files which give access to a TabStrip
     control - both Microsoft, and both installed by either VB5.0 or SP2 (as
     above). They are:
     COMCTL32.OCX (version 5.01.4319)
     FM20.DLL (version 2.01)

     Both have VERY different implementations of the same control. I was using
     the one from FM20.DLL - and, by my best estimation, it doesn;t work. The
     one in COMCTL32.OCX works fine with my existing code.

     Thanks for your help, and why the hell did MSoft put out two different versions
     of the same control (they even have different parameter lists and orders for
     some methods!)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question