How can I detect, if the Form is changed? |
Post Reply |
Author | |
Jebo
Senior Member Joined: 27 October 2005 Location: Germany Status: Offline Points: 318 |
Post Options
Thanks(0)
Posted: 29 February 2012 at 5:59am |
Hello,
for TabWorkspace in CommandBars the SelectedChanged-Events fires too early (it fires before the ActiveForm of MDI-Application was changed!) and the "Form_Activate" Event from VB fires too late (the Form is already visible ). So HOW PLEASE can I detect, what Form will open, if the user clicks on a Tab? |
|
[Sig removed by Admin: Signature can't exceed 40GB]
|
|
Jebo
Senior Member Joined: 27 October 2005 Location: Germany Status: Offline Points: 318 |
Post Options
Thanks(0)
|
Any help please?
|
|
[Sig removed by Admin: Signature can't exceed 40GB]
|
|
Jebo
Senior Member Joined: 27 October 2005 Location: Germany Status: Offline Points: 318 |
Post Options
Thanks(0)
|
HELLOOOOOO? CJ-Team!?
|
|
[Sig removed by Admin: Signature can't exceed 40GB]
|
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
I don't understand the problem, SelectedChanged is exactly what you want. You can grab Item.Handle in this event to get object displayed in the tab. I modified the Commandbars MDI Sample:
Private Sub Workspace_SelectedChanged(ByVal Item As XtremeCommandBars.ITabControlItem) On Error Resume Next Dim x As frmDocument Dim i As Long For i = Forms.Count - 1 To 0 Step -1 If Forms(i).hwnd = Item.Handle Then Set x = Forms(i) If Item.Index Mod 2 Then x.rtfText.BackColor = vbRed x.rtfText.Text = "hello" Else x.rtfText.BackColor = vbBlue x.rtfText.Text = "good bye" End If End If Next Debug.Print "Workspace_SelectedChanged. Item.Caption = " & Item.Caption End Sub |
|
Jebo
Senior Member Joined: 27 October 2005 Location: Germany Status: Offline Points: 318 |
Post Options
Thanks(0)
|
But this is exactly the problem. Why do you call this event "SelectedChanged" and not "SelectChange"?
And WHY I must do a slow "For...Each" Loop to find the "SELECTED" form? Your "way" I already use (but I was shure, there is a better way instead for this "workaround"). |
|
[Sig removed by Admin: Signature can't exceed 40GB]
|
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
I'm sorry, I don't know what else to tell you. First this is a tab workspace event, so it fires when the tab is selected has changed (it provides reference to the newly selected tab).
How is this slow? You would run out of memory before you could have enough forms open to effect performance. This is a simple comparison. Since you can attach many different things to the tab, how can we know what it will be? Providing the handle is the only thing we can do. Aside from you not liking the name of the event, what do you suggest we change?
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |