xiaoding721
2023-11-13 e4edcfd0b987b239526f5375881b919789782dad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Quintiq file version 2.0
#parent: #root
Method GetPanel () as LibOpt_Panel id:Method_LibOpt_FormBase_GetPanel
{
  #keys: '[139164.0.361144649]'
  Body:
  [*
    // Returns the instance of the LibOpt_Panel control
    // that was added to the consuming application.
    panelOutput := this.DataHolderPanel().Data();
    
    if ( isnull( panelOutput ) )
    {
      set := selectset( this.Application(), SubComponents, sc, true );
      safetyCounter := 0;
      panel := null( GUIComponent );
      while ( set.Size() > 0 and safetyCounter < 20 and isnull( panel ) )
      {
        panel := select( set, Elements, p, p.istype( LibOpt_Panel ) );
        if ( isnull( panel ) )
        {
          set := selectset( set, Elements.SubComponents, sc, true );
        }
        safetyCounter++;
      }
      
      // Warn the consumer of this library that the panel has not been
      // added to the main form.
      if ( isnull( panel ) )
      {
        info( "Components: Could not find an instance of the LibOpt_Panel component. Please add this component to your application's main toolbar. " );
      }
      else
      {
        panelOutput := panel.astype( LibOpt_Panel )
        this.DataHolderPanel().Data( panelOutput );
      }
    }
    return panelOutput;
  *]
}