PDA

View Full Version : psTitle in DockingPane of the shortcut



Matthias
1-Sep-2009, 06:58 AM
I tried to change the title of the docking pane in my shortcutbar. Every time If I click on a different tab the title of this tab should appear on the top. (like Outlook: if I click on calendar "calendar" appears on the 1st line)
However I can't get it work. I've got an GPF if I try to use "Set ComTitle of oShortcutbar_Pane to ..."
Any hints for this task? What is the corresponding procedure for the menubar change?

Ian Smith
3-Sep-2009, 08:10 AM
Hi Matthias

To test this I made the following changes to the demo app. The bit you appear to be missing is the OnCreate augmentation. What this does is re-attach the VDF side pane objects to the COM side objects.

If you turn off Layout Saving (Set pbPX_Save_Layout to False) then you do not need to do this. I think the Codejock control is destroying its pane objects and recreating them when the layout is loaded.

What I do not understand is that the iDispatch (pvComObject) values do not change and this is the reason why I have not (yet) changed the classes. I have emailed DAW asking if they can explain what & why. I will let you know what the gurus say.


1. Codejock Order Sample.src - Added the following methods to Object oDockingManager is a cSigCjDockingManager


Procedure OnCreate
Handle hoPane
Integer iPane_Count
Integer iPane iID
Integer[] iVDF_Objects
Variant vPane

Forward Send OnCreate

If (pbPX_Save_Layout(Private_phoLayout(Self))) Begin
Get piVDF_Objects to iVDF_Objects
Get Create U_cSigCjComPane to hoPane

Get ComPanesCount to iPane_Count
For iPane from 0 to iPane_Count
Get ComPanes iPane to vPane
If (not(IsNullComObject(vPane))) Begin
Set pvComObject of hoPane to vPane
Get ComId of hoPane to iID
Set pvComObject of iVDF_Objects[iID] to vPane
End
Loop
End
End_Procedure

Procedure Change_Title Handle hoClient String sTitle
Handle hoPane_Client
Integer iPane_Count iPane iRetVal
Integer[] iaVDF_Objects

Get piVDF_Objects to iaVDF_Objects

Move (SizeOfArray(iaVDF_Objects)) to iPane_Count
Decrement iPane_Count
If (iPane_Count > 0) Begin
For iPane from 0 to iPane_Count
If (iaVDF_Objects[iPane] > 0) Begin
Get phoClientObject of iaVDF_Objects[iPane] to hoPane_Client
If (hoPane_Client = hoClient) Begin
Set ComTitle of iaVDF_Objects[iPane] to sTitle
Move iPane_Count to iPane //bomb loop
End
End
Loop
End
End_Procedure
2. oShortCutBar_Container.pkg - Added the following method to Object oSigCjShortCutBar is a cSigCjShortCutBar


//Hate the next line but we have a chicken and egg situation!!!
Register_Object oDockingManager

Procedure OnComSelectedChanged Variant llItem
Handle hoItem hoParent
String sCaption

Get Create U_cSigCjComShortcutBarItem to hoItem
Set pvComObject of hoItem to llItem

Get ComCaption of hoItem to sCaption
Send Change_Title of oDockingManager (Parent(Self)) sCaption
End_Procedure

Matthias
3-Sep-2009, 10:49 AM
Hello Ian,
thank you very much for your help. It works fine with one exception: If pbPX_Save_Layout is true the program also saves the last selected caption (for example the 3rd) in the registry and load this name again at the next startup.

Ian Smith
3-Sep-2009, 01:17 PM
Hi Matthias

Chicken and egg time again. The shortcut bar is created before that docking panes, therefore there are no panes to set the title of when the shortcut bar event OnComSelectedChanged is fired.

The changes below (for oDockingManager) check if there are any panes and if not caches the title and pane client info in the two new properties. The OnCreate on the Docking Manager then check for a cached title and applies it if necessary.

It is a bit clunky, but it works.


//Title caching properties
Property Handle phoPane 0
Property String psTitle ""

Procedure OnCreate
Handle hoPane
Integer iPane_Count
Integer iPane iID
Integer[] iVDF_Objects
Variant vPane

Forward Send OnCreate

If (pbPX_Save_Layout(Private_phoLayout(Self))) Begin
Get piVDF_Objects to iVDF_Objects
Get Create U_cSigCjComPane to hoPane

Get ComPanesCount to iPane_Count
For iPane from 0 to iPane_Count
Get ComPanes iPane to vPane
If (not(IsNullComObject(vPane))) Begin
Set pvComObject of hoPane to vPane
Get ComId of hoPane to iID
Set pvComObject of iVDF_Objects[iID] to vPane
End
Loop
End

//Change title if one has been cached
If (phoPane(Self) <> 0) Begin
Send Change_Title (phoPane(Self)) (psTitle(Self))
End
End_Procedure

Procedure Change_Title Handle hoClient String sTitle
Handle hoPane_Client
Integer iPane_Count iPane iRetVal
Integer[] iaVDF_Objects

Get piVDF_Objects to iaVDF_Objects

Move (SizeOfArray(iaVDF_Objects)) to iPane_Count
Decrement iPane_Count
//Check that panes have been created
If (iPane_Count > 0) Begin
For iPane from 0 to iPane_Count
If (iaVDF_Objects[iPane] > 0) Begin
Get phoClientObject of iaVDF_Objects[iPane] to hoPane_Client
If (hoPane_Client = hoClient) Begin
Set ComTitle of iaVDF_Objects[iPane] to sTitle
Move iPane_Count to iPane //bomb loop
End
End
Loop
End
Else Begin
//No panes created so cache title
Set phoPane to hoClient
Set psTitle to sTitle
End
End_Procedure

Matthias
4-Sep-2009, 03:39 AM
Thank you, Ian. Now it's perfect.