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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SSTab with Frame bug? 4

Status
Not open for further replies.

markSaunders

Programmer
Jun 23, 2000
196
GB
I have added a frame to an sstab (v6) with [three] tabs. on the first tab i have placed a frame. if i have [for illustrative purposes] the following code on the form_resize<br><br>frame.left = frame.left - 1<br><br>then this works fine and the frame appears only on the first tab, with the line being executed each time the event is triggered.&nbsp;&nbsp;if however the code is such as<br><br>frame.left = iBorder<br>OR<br>frame.left = 120<br><br>then the frame appears on the first & OTHER tabs?<br><br>i suspect the only method is to make the objects on the other tabs invisible? but any ideas/suggestions would be appreciated.<br>cheers <br>Mark Saunders
 
Hi Mark,<br><br>I've just tried it and it worked ok for me.<br><br>TabCtl with 3 tabs, frame on tab 0, frame1.left = 370 in form_resize event.<br><br>I have had similar(ish) troubles in the past when trying to use tabs and frames to encapsulate other controls and it's always turned out that that I haven't put the control <i>inside</i> the tab/frame.<br><br>You can check this by moving, in design mode, the tab. If the frame moves with it - it's inside the tab. If it doesn't it's just in <i>front</i> of it.<br><br>If that's the case (that the frame doesn't move with the tab) then:<br><br>1 Click on the frame<br>2 Ctrl-X to cut the frame (it will disappear - no worries)<br>3 Click on the tab<br>4 Ctrl-V to paste the frame into the tab, you'll have to move it around a bit manually to get it to look right.<br><br>I hope this helps and I'm not misunderstanding you completely. Forgive the step by step instructions, they're for people (like me) who don't understand this new-fangled windows stuff yet.<br><br> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
doh! i had throught i'd actually done this so i got a colleague to do it (just to confirm how correct i WAS)... anyway just goes to show the value of a second opinion! thanks v much<br>M
 
it's reappeared! i even created a new project, added the MStabbed control (SP3) and the placed Frame1 on tab sheet 0, Frame2 on tab sheet 1. then *only* code in the project is<br><br>Private Sub Form_Resize()<br>&nbsp;&nbsp;&nbsp;&nbsp;Frame1.Left = 240<br>&nbsp;&nbsp;&nbsp;&nbsp;Frame2.Left = SSTab1.Width - Frame2.Width - 240<br>End Sub<br><br>and on running the project, both frames appear on Tab(0), just Frame2 appears on Tab(1) and no frames appear on Tab(2)
 
Curiouser and curiouser (as someone once said)....<br><br>Have you gone through the whole cut and paste excersise again? It is *irritatingly* easy to get this wrong, I'm always doing it. <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
check out the (3k) file titled BUGwithFrames.zip at <A HREF=" TARGET="_new"> which contains a simple VB project of two forms.<br><br>they are identical except on the button_click event Form1 resets frames1,2,3 (contained on different tabs) to .left+1 and Form2 forces an integer to the frames.<br><br>you will see that forcing an integer to the frames cause it and all its contents to be displayed on the current tab (note also this status is saved as you flick to and from other tabs!)<br><br>strange, but true - let me know what u think<br>cheers M
 
That is *WEIRD* -- you're right though. And thanks for the tip. <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
I think I may be able to explain this one!<br><br>Bear in mind that the 'Left' property of any control is actually 'provided' by the container of that control. The SSTab activeX allows the easy design-time use of controls on it's tabs by directly manipulating the left properties of all the controls on any particular tab. i.e. When you click on a tab, the SSTab control quickly alters all the required 'left's to ensure that what controls you see are the ones on that tab.<br><br>When you do a Frame2.left = Frame2.left - 1 you are not making assumptions about the value SSTab has placed in Frame2.left and therefore this works.<br><br>However, if you set Frame2.Left to an absolute value, you have just overridden SSTab mechanism for controlling Frame2's visibility and Frame2 magically appears in the form.<br><br>Basically, you think you are placing controls on a tab, but you aren't. SSTab housekeeps their visibility for you using .Left, but woe-betide you if you mess with this.<br><br>Mark knows that I always use the style of tabs provided by the 'Options Dialog' wizard. This is a bit of a pain at design-time since you have to manually administer the .Left properties of a picture box per tab, but it always works fine at run-time since you know that nothing else is using those .Lefts to make it work.<br><br>Sorry this is wordy explanation, but it is quite an interesting phenomenon.<br><br>Regards, Tim
 
fyi - a useful suggestion (<i>thanks tim</i>) to utilise the design time advantages of the <FONT FACE=monospace>SSTab</font> and perhaps avoid the problems indicated above is to first place a picture box on the tab sheet and never alter the <FONT FACE=monospace>.Left</font> property. place the necesssary objects for that Tab Sheet on the Picture Box and the <FONT FACE=monospace>.Left</font> property of the objects can be manipulated without the Picture Box being brought onto view.<br><br>see the file <font color=red>sstabBugGetAround.zip</font> at <A HREF=" TARGET="_new"> for a simple example.<br><br>cheers M
 
because i DO like the ease of using this somewhat dodgy control in the IDE environment i use the little routine as below:

Code:
Private Sub SSTab1_LostFocus()
    If SSTab1.Tab <> 2 Then
        fraWithControlsOn.Enabled = False
    Else
        fraWithControlsOn.Enabled = True
    End If
End Sub
Mark Saunders :)
 
I'm having the same goofiness that was described at the beginning of this thread and thanks to those who at least showed me what the problem is. Now I'm hoping for input as to how to get out of the problem.

I have a tab control with tons of stuff on it (I've hit the 255 limit). In anycase, the really fun part about this project is that everything is to be configurable. Part of this configurableness is that the user must be able to move the controls in the user interface. In order to do this, I have a (rather large) ini file where I store all the placement information. When the application starts, it reads it all and sets the appropriate properties. You see, I need to be able to set the left property somehow... does anyone have any suggestions to make this as painless as possible?

Thanks!

~Melissa
 
Store the form layout information in a database and have one generic routine that will dynamically build the forms as each tab becomes visible . . . this is actually pretty easy to do and you will get better performance than you would with 255 controls loaded into memory. The idea is to only have that controls visible that really have to be visible. - Jeff Marler
(please note, that the page is under construction)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top