• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 139
  • Last Modified:

WHy does this happen? Control Placment


I start a new project

then draw an sstab control on the form.

I then select the second Tab of the tab control. (ie current tab = 2)

then I draw 2 command buttons on the tab control.

I stick the followig code in the from resize event of Form1.

SSTab1.Width = Form1.Width
Command1.Width = SSTab1.Width / 2
Command2.Left = Command1.Width

when the programme is executed

all seems well, the two command button can we seen when you select the second tab.

select the first tab

then resize the form

the command2 button shows up on the first tab.

It seem to have 'fallin out' of the tab  container.

Why does this happen?

Any hhelp greatly appericated
1 Solution
Ryan ChongCommented:
More complete codes ..
How SStab works ????

It simply change LEFT Property of controls in other tabs except current one to negative values to put them OUT SCREEN

Ur Code
Command1.Width = SSTab1.Width / 2
Command2.Left = Command1.Width

Command2.Left  a posiotive value always
So it pops on current tab

Should be
Command2.Left = Command1.left + SomeValueLessthanTabWidth
Hope I helped
I couldn't repeat it except by adding one of the command
buttons to the form and moving it over the tab (inotherwords not actually on/in the tab although it looks like it is). That being said I have in the past experienced similar behaviour but with heavy duty controls
like Rich text boxes and treeviews where they inexplicably
started showing up on the wrong tabs, especially on form resize events. This appeared to be a repaint problem with the tab control, from memory doevents fixed it.
So in summary, first check it is IN the correct tab.
Otherwise try doevents.
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Éric MoreauSenior .Net ConsultantCommented:
the sstab controls deals with the Left property of contained controls. you can't paly with this property without some caution. see http://support.microsoft.com/default.aspx?scid=kb;en-us;Q187562
emoreau - nice one! explains a lot.
Anthony PerkinsCommented:
Please maintain your open questions:
Questions Asked 14
Last 10 Grades Given A A A B B A B A  
Question Grading Record 8 Answers Graded / 8 Answers Received

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now