Print Page | Close Window

Changing the title of a pane

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=1678
Printed Date: 16 June 2024 at 8:53am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Changing the title of a pane
Posted By: Maui
Subject: Changing the title of a pane
Date Posted: 18 January 2005 at 4:08pm

I have created a pane. The pane shows the contents of a folder.

I want to set the title of the pane to be whatever the current directory on show is.

I used this code.

        Set P = .DockingPane.FindPane(ID_PANE_GALLERY)
        If Not P Is Nothing Then
             P.Title = sPath
             Debug.Print "new title=" & sPath
        End If

The Title doesnt change even though I can see with the debug that the correct info is being passed.

There is no .refresh method so Im not sure what to do next?

Please dont tell me that the only answer is to destroy and then recreate the pane.

Thanks 

 




Replies:
Posted By: nighthawk
Date Posted: 18 January 2005 at 4:25pm
Try adding the line:

P.RedrawPanes

after setting the title.


Posted By: Maui
Date Posted: 19 January 2005 at 6:05am

Cheers

.DockingPane.RedrawPanes works as long as the panes are docked.

If the panes arent docked then they arent effected until they are redocked.

CJ support - Pls log this as a bug.



Posted By: Boyd
Date Posted: 19 January 2005 at 7:37am

I found this a long time ago and created a workaround for it.  I figured this would have been fixed by now, but I guess not.  This work-around was designed before the ThemedFloatingPanes option was introduced, so I don't know how that will affect it, but you can play with it to make it work.  The general idea behind this was that a floating pane was actually a window with a title bar.  The workaround was to use the 'SetWindowText' API function to directly change the title of the window.  I wrapped it up into a function that took three parameters... the DockingPane object, the ID of the pane to update, and the new title.

Declare Function SetWindowText Lib "user32.dll" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) As Long
Declare Function GetParent Lib "user32.dll" (ByVal hWnd As Long) As Long
Public Sub UpdatePaneTitle(ByRef dockingPanes As DockingPane, ByVal iPaneID As Integer, ByVal sTitle As String)
    Dim hWnd As Long, p As Pane
    Set p = dockingPanes.FindPane(iPaneId)
    If p Is Nothing Then Exit Sub
    p.Title = sTitle
    If p.Floating = True Then
        'The container for the floating form is two levels up from
        'the docked item itself.  We need to update both captions.
        SetWindowText p.handle, sTitle
        hWnd = GetParent(GetParent(p.handle))
        If hWnd <> 0 Then
             SetWindowText hWnd, sTitle
        End If
    Else
        dockingPanes.RecalcLayout
    End If
End Sub

At the time, I don't think the 'RedrawPanes' method existed, so I used 'RecalcLayout' instead.  I'm sure you can tweak this to accomplish what you need.  Hope this helps!  Of course, it'd still be nice if Codejock can wrap up a resolution to this.



Posted By: Maui
Date Posted: 20 January 2005 at 10:06am

Looks great.

Thank you for your help. I will let you know how I get on.



Posted By: Maui
Date Posted: 22 January 2005 at 4:32pm

Had 5 mins this morning on the PC and tried your suggestion but it didnt work.

Wont have time to get on the PC for a few days so it will be a while before I can test this further.

Here's hoping that the next release will address this problem.

 



Posted By: Boyd
Date Posted: 22 January 2005 at 5:04pm
Sorry... I think I used this back in the v8.x days, so I guess it doesn't work anymore.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net