This is a migrated thread and some comments may be shown as answers.

front to back ordering od docks

3 Answers 74 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 11 Jul 2008, 03:51 PM

I am writing an application that allows a user to add many docks to the same page at once.  Currently, when a dock is added, it is placed "in front" of all the previous docks so that if more than one occupy the same screen area, the last one added will be in front of all the others.

I'm looking for a way to set the order of these docks so that the user can choose which docks are in front and in back.  The functionallity I'm looking for can be thought of as a kind of  "bring to front, send to back" type functionallilty seen in many programs.

I've played around with setting the z-index and that works fine when creating a dock in a CreateRadDock() Function using the following code.

dock.Style("z-index") = "1000" 

This same code also works in a dock command to set the z-index to a higher or lower number depending on the command.

The problem comes on postback when running CreateRadDockFromState().  Apparently the dock state doesnt store the front to back order of the docks.  Or at least I cant see it if it does.  So I have no way of determining the current value of z-index for the dock being created from a previous state.

Are there any suggestions or code samples to accomplish this?  Here is my relavant code: 

    Private Function CreateRadDock() As RadDock  
        Dim docksCount As Integer = CurrentDockStates.Count  
        Dim dock As New RadDock()  
        dock.Left = LeftPane.Width.Value - (Width / 2) + (ContentPane.Width.Value / 2)  
        dock.Top = ContentPane.Height.Value / 4  
        dock.Attributes.Add("onclick", "onDockClick(this);")  
        dock.Resizable = True 
        dock.Style("z-index") = "1000"  
 
        'dock.DockMode = DockMode.Floating  
        dock.UniqueName = Guid.NewGuid().ToString()  
        dock.ID = String.Format("RadDock{0}", dock.UniqueName)  
        dock.Text = String.Format("Added at {0}", DateTime.Now)  
        dock.OnClientResizeEnd = "onDockResizeEnd" 
        dock.OnClientDragEnd = "onDockClientDragEnd" 
        dock.OnClientCommand = "onDockCommand" 
 
        Dim cmdSendToBack As New DockCommand  
        cmdSendToBack.Name = "SendToBack" 
        cmdSendToBack.Text = "Send To Back" 
        cmdSendToBack.AutoPostBack = True 
        dock.Commands.Add(cmdSendToBack)  
 
        AddHandler dock.Command, AddressOf dock_Command  
        Return dock  
    End Function  
      
   Private Function CreateRadDockFromState(ByVal state As DockState) As RadDock  
        Dim dock As New RadDock()  
        dock.ID = String.Format("RadDock{0}", state.UniqueName)  
        dock.Attributes.Add("onclick", "onDockClick(this);")  
 
        dock.ApplyState(state)  
        dockdock.Text = dock.UniqueName  
        AddHandler dock.Command, AddressOf dock_Command  
 
        dock.OnClientResizeEnd = "onDockResizeEnd" 
        dock.OnClientDragEnd = "onDockClientDragEnd" 
        dock.OnClientCommand = "onDockCommand" 
 
        Dim cmdSendToBack As New DockCommand  
        cmdSendToBack.Name = "SendToBack" 
        cmdSendToBack.Text = "Send To Back" 
        cmdSendToBack.AutoPostBack = True 
        dock.Commands.Add(cmdSendToBack)  
 
 
        Return dock  
    End Function      
      
    Sub dock_Command(ByVal sender As Object, ByVal e As DockCommandEventArgs)  
        Select Case e.Command.Text  
            Case "Send To Back"  
                Dim myDock As RadDock = DirectCast(sender, RadDock)  
                myDock.Style("z-index") = "500"  
        End Select  
 
    End Sub  

3 Answers, 1 is accepted

Sort by
0
Sophy
Telerik team
answered on 14 Jul 2008, 07:22 AM
Hi Chad,

If you want to save in the state the z-index of the RadDock which you have set when creating the control I suggest you try to pass it to the RadDock's Tag property. The dock's Tag is a property which is saved in the dock's state and allows to store and load some information needed for recreating the control which is not saved in the state by default. In the MyPortal online example the dock's Tag is used for storing the needed information to create the custom control.
If you need further assistance, do contact us again.

Kind regards,
Sophy
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Rich
Top achievements
Rank 1
answered on 16 Jul 2008, 04:17 PM
I am already using dock.tag to store the value of a user control that is contained in the dock.

Can dock.tag store more than one value?
0
Sophy
Telerik team
answered on 17 Jul 2008, 06:59 AM
Hi Rich,

The dock.Tag accepts a string as a value. You can store the needed values as a string separated by semicolons, for example, and retrieve their values afterwards splitting the string, e.g.:
RadDock1.Tag = "string1;string2";  
string[] strings = RadDock1.Tag.Split(';'); 
If you have any other questions, do contact us again.

Sincerely yours,
Sophy
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Dock
Asked by
Chad
Top achievements
Rank 1
Answers by
Sophy
Telerik team
Rich
Top achievements
Rank 1
Share this question
or