Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - How can I detect, if the Form is changed?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How can I detect, if the Form is changed?

 Post Reply Post Reply
Author
Message
Jebo View Drop Down
Senior Member
Senior Member


Joined: 27 October 2005
Location: Germany
Status: Offline
Points: 318
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jebo Quote  Post ReplyReply Direct Link To This Post Topic: How can I detect, if the Form is changed?
    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 Confused).

So HOW PLEASE can I detect, what Form will open, if the user clicks on a Tab? Ouch

[Sig removed by Admin: Signature can't exceed 40GB]
Back to Top
Jebo View Drop Down
Senior Member
Senior Member


Joined: 27 October 2005
Location: Germany
Status: Offline
Points: 318
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jebo Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2012 at 4:57am
Any help please?
[Sig removed by Admin: Signature can't exceed 40GB]
Back to Top
Jebo View Drop Down
Senior Member
Senior Member


Joined: 27 October 2005
Location: Germany
Status: Offline
Points: 318
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jebo Quote  Post ReplyReply Direct Link To This Post Posted: 08 March 2012 at 7:36am
HELLOOOOOO? CJ-Team!?
[Sig removed by Admin: Signature can't exceed 40GB]
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 09 March 2012 at 9:48am
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
Back to Top
Jebo View Drop Down
Senior Member
Senior Member


Joined: 27 October 2005
Location: Germany
Status: Offline
Points: 318
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jebo Quote  Post ReplyReply Direct Link To This Post Posted: 09 March 2012 at 10:09am
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"). Geek
[Sig removed by Admin: Signature can't exceed 40GB]
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 09 March 2012 at 10:42am
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?
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.