Error with automatic management of the toolwindowsfamily.

1 Answer 21 Views
General Discussions GridView
Laurent
Top achievements
Rank 1
Iron
Iron
Laurent asked on 25 Sep 2025, 02:49 PM

message error: La référence d objet n'est pas définie à une instance d'un objet.

Hello,
In my Frame, I use a RadDock with documentContainer and two toolwindows.
I would like the toolWindowFamily to dock automatically when I select it, rather than having to press the “pin” image.

On the “stabstripItem_click”, I put: oToolwindow:DockState=  Telerik.WinControls.UI.Docking.DockState:Docked.

Here is my code:

 

METHOD PRIVATE VOID TabStripItem_Click( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):

        DEFINE VARIABLE oTabStripItem AS Telerik.WinControls.UI.TabStripItem       NO-UNDO.
        DEFINE VARIABLE oToolwindow   AS Telerik.WinControls.UI.Docking.ToolWindow NO-UNDO.
        DEFINE VARIABLE cValeur       AS CHARACTER                                 NO-UNDO.        

        oTabStripItem = CAST(sender, Telerik.WinControls.UI.TabStripItem) NO-ERROR.
        IF oTabStripItem NE ? THEN 
        DO:
            oToolwindow = CAST(oTabStripItem:TabPanel, Telerik.WinControls.UI.Docking.ToolWindow) NO-ERROR.

            IF VALID-OBJECT(oToolwindow) THEN DO:

                IF oToolwindow NE ? THEN 
                DO:

                    IF THIS-OBJECT:DockPrincipal:ActiveWindow NE oToolwindow THEN 
                    DO:                     
                        oActiveWindow = THIS-OBJECT:DockPrincipal:ActiveWindow.
                        cValeur = THIS-OBJECT:oongFamilleListe:GetToolwindowFurtifValeur( oToolwindow:NAME ).

                        InitialiseToolWindow( oToolwindow:NAME ).
                        CASE oToolwindow:Name:                        
                            WHEN gcToolWindowNomAide[1] THEN DO:
                                IF cValeur NE "?" AND cValeur NE 'OFF'
                                    THEN THIS-OBJECT:oongCodeAnalytiqueAide:Initialisation(cValeur).                                
                                    ELSE THIS-OBJECT:oongCodeAnalytiqueAide:Initialisation("").

                                oToolwindow:Enabled = ( cValeur NE "?" AND cValeur NE 'OFF').        
                            END.
                            WHEN gcToolWindowNomFiltre[1] THEN DO:   

                               glDockParCode= YES.            
                               oToolwindow:DockState=  Telerik.WinControls.UI.Docking.DockState:Docked.
                               glDockParCode= NO.

                                oToolwindow:Enabled = YES.      
                                gcNoeudCourant = 'C000'.
                                glFiltreVisibleFamille = YES.  
                                oongFamilleArborescence:SelectionNoeud(gcNoeudCourant).

                                IF glRafraichir THEN DO:
                                    SetEtatObjet("BtnSupprimer", NO).                                    
                                    //SetEtatObjet("BtnCopier", NO).
                                    //SetEtatObjet("BtnColler", NO).
                                    //SetEtatObjet("BtnCollerInserer", NO).
                                    oongFamilleListe:SetParamFiltreFamille ( glFiltreVisibleFamille ,gcNoeudCourant ).  
                                    oongFamilleListe:Rafraichir( ).

                                END.

                            END.                                               
                        END CASE.

                        THIS-OBJECT:DockPrincipal:ActiveWindow = oToolwindow.

                    END.
                    ELSE 
                    DO:
                        THIS-OBJECT:DockPrincipal:CloseAutoHidePopup().
                        oToolwindow:AutoHideTab:Click:UnSubscribe(THIS-OBJECT:TabStripItem_Click) NO-ERROR.
                        oToolwindow:AutoHideTab:Click:Subscribe(THIS-OBJECT:TabStripItem_Click) NO-ERROR.
                        IF THIS-OBJECT:DockPrincipal:ActiveWindow NE oActiveWindow THEN
                            THIS-OBJECT:DockPrincipal:ActiveWindow = oActiveWindow.
                    END.
                END.
            END.
            ELSE DO:
                MESSAGE 'ERR - TabStripItem_Click '
                VIEW-AS ALERT-BOX.
                RETURN.
            END. 
        END.             
      /*                   
      IF lFlgDocked THEN DO:                      
          //oToolwindow:AutoHideTab:Click:UnSubscribe(THIS-OBJECT:TabStripItem_Click) NO-ERROR.
                           glDockParCode = YES.
                           oToolwindow:DockState=  Telerik.WinControls.UI.Docking.DockState:Docked NO-ERROR.  
                           oToolwindow:Tag = "ON".
                           glDockParCode = NO.
                       //    oToolwindow:AutoHideTab:Click:Subscribe(THIS-OBJECT:TabStripItem_Click) NO-ERROR.
      END.  
      */              
        RETURN.
    END METHOD.

 

                                                                                                                                                                                                                                                                                                                                                                                                           

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 30 Sep 2025, 12:06 PM

Hi Laurent,

Thank you for contacting us.

In general, to programmatically dock a ToolWindow, you can use the DockWindow() method of the RadDock control. RadDock offers several overloads for the DockWindow method, accepting the source window, the target window, and the DockPosition. Thus, you can dock a window at a certain position, e.g. bottom, according to another target window. For example, if I create a new ToolWindow in code, I can directly dock it inside the control, if there are no other windows:

ToolWindow toolWindow1 = new ToolWindow();
toolWindow1.Text = "A ToolWindow";
radDock1.DockWindow(toolWindow1, DockPosition.Left);
If you want to dock by the given target window:

ToolWindow toolWindow1 = new ToolWindow();
toolWindow1.Text = "A ToolWindow";
radDock1.DockWindow(toolWindow1,this.documentWindow1, DockPosition.Bottom); // documentWindow1 is already docked window

I hope that this method will work for you. 

As for the error, I assume that setting the DockState property is the reason why it appears. Consider using the DockWindow() method instead.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Your perspective matters! Join other professionals in the State of Designer-Developer Collaboration 2025: Workflows, Trends and AI survey to share how AI and new workflows are impacting collaboration, and be among the first to see the key findings.
Start the 2025 Survey
Laurent
Top achievements
Rank 1
Iron
Iron
commented on 30 Sep 2025, 02:49 PM

Bonjour,

Le problème vient pas sur la gestion du docking, mais qu'a l'éxecution de la méthode TabStripItem_Click, le fait de force le

oToolwindow:DockState=  Telerik.WinControls.UI.Docking.DockState:Docked NO-ERROR.  

engendre une erreur.

Il faudrait trouver un event qui fait se fait après ou je pourrais metytre cette instruction. Ou alors ?????

Dinko | Tech Support Engineer
Telerik team
commented on 01 Oct 2025, 11:36 AM

 I want to point out that you should submit your tickets in English, as it is the official language to provide support to our customers. I have used a translator to translate, but I am still not sure that I have fully understood the error here.

Does setting DockState cause an error, or is some other code in the method leading to the exception? Instead of setting the DockState property, can you try using the DockWindow() method of the RadDock control? Then check if that lead to the error again.

Tags
General Discussions GridView
Asked by
Laurent
Top achievements
Rank 1
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or