|
-
Apr 19th, 2007, 08:57 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Resizing objects bring to front other objects in SSTab
Hi.
I've got a SStab object with 3 tabs. Each tab has one MSHFlexGrid.
These object are in a MDIForm Child.
When I resize the child form, i'll do this code:
Code:
'Consultas is a form
'every object started with Grid is a MSHFlexgrid
Public Sub FormConsultas()
On Error GoTo Erro
Consultas.SSTab1.Height = Consultas.Height
Consultas.SSTab1.Width = Consultas.Width
If Consultas.Width < 11925 Then Consultas.Width = 11925
If Consultas.Height < 8055 Then Consultas.Height = 8055
Consultas.GridFactESDDExp.Move 90, 600, Consultas.Width - 420, Consultas.Height - 2000
Consultas.GridAcordoHorasFech.Move 90, 600, Consultas.Width - 420, Consultas.Height - 2000
Consultas.GridAvisosCobrancas.Move 90, 600, Consultas.Width - 420, Consultas.Height - 2000
Erro:
Select Case Err.Number
Case 0
Case 384
Case Else
MsgBox Err.Number & " - " & Err.Description & " - " & Err.Source
End Select
End Sub
What happens is: after resizing the form, sometimes, the grid of the 2nd tab persist visible when tab 1 is selected.
What can explain this behavior, and how can I avoid this?
Thanks
-
Apr 19th, 2007, 09:11 AM
#2
Re: Resizing objects bring to front other objects in SSTab
If the grid of the 2nd tab is Consultas.GridAcordoHorasFech, you can
Consultas.GridAcordoHorasFech.Visible = False
Last edited by Al42; Apr 19th, 2007 at 09:27 AM.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Apr 19th, 2007, 09:37 AM
#3
Thread Starter
Hyperactive Member
Re: Resizing objects bring to front other objects in SSTab
Ok, that could be one possible way to resolve my problem.Thanks!
But can you tell me why that behavior happens?
-
Apr 19th, 2007, 02:35 PM
#4
Re: Resizing objects bring to front other objects in SSTab
But can you tell me why that behavior happens?
To understand why this happens you need to understand how the SSTab works.
The SSTab really only has one container. It simply moves controls on and off the container by changing their Left property. It does this by adding and subtracting 75000 to the left property of each control on the container as you switch tabs.
For example, a control whose Left property is 360 when it is on the current Tab becomes -74640 (360 - 75000) when you switch tabs. Switch back and it adds the 75000 back to the Left property. When you change the Left property in code, you are in effect moving the control onto the current Tab.
Note this only affects controls whose container is the SSTab. The Left property of controls in a Frame which is on the SSTab are not manipulated, only the Frame's Left property is changed.
To resolve this problem here are some options. I would recommend # 3.
1) Don't change the Left property.
2) Only change the Left property of controls that are on the current Tab
If for some reason you need to change the Left property of all controls on every tab simply set the current Tab before doing so.
Code:
Consultas.Tab = 0
Consultas.GridFactESDDExp.Move 90, 600, Consultas.Width - 420, Consultas.Height - 2000
Consultas.Tab = 1
Consultas.GridAcordoHorasFech.Move 90, 600, Consultas.Width - 420, Consultas.Height - 2000
Consultas.Tab = 2
Consultas.GridAvisosCobrancas.Move 90, 600, Consultas.Width - 420, Consultas.Height - 2000
3) Put a Frame on every Tab and place the controls for the Tab on the Frame. The SSTab only has to worry about the Frame controls and when you change the Left property of controls via code it is relative to the Frame not the SSTab.
-
Apr 20th, 2007, 06:30 AM
#5
Thread Starter
Hyperactive Member
Re: Resizing objects bring to front other objects in SSTab
Ok. That's enough for me, thank you.
I'll try your suggestions.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|