scaCollapse

Description of control

scaCollapse is a multi-purpose GeneXus User Control created for expand and collapse elements of a form. For example, you can create an accordion, a collapsible list, a form and much more.

Compatibility

Web

Using the control

The control can be used for any element in the web form and be applied for a grid, tables, image, textblock, variables etc.
It is very simple, you just need to include this User Control in your master page or web panel and then Collapse/Expand form elements using control's standard Visible property.

Example:

Event 'Collapse-Simplifica-Logo'
     SimplificaLogo.Visible = False
EndEvent

 
Simply? Yes! You don't need to do anything special.
 
Summarizing, you can choose the effect to be applied while the element is being collapsed. To do this, you need to have the "Effect" property in design time (properties dialog) or run-time (by code) Possible values are: fade and slide.
 
Example:

Event 'Collapse-Simplifica-Logo'
     scaCollapse1.Effect = "slide"
     SimplificaLogo.Visible = False
Endevent

 
If you want to use this effect only in a specific event, you can use the "Active" property. Set value for property Active to False using the properties dialog of the control and in the event that you want to do the magic add: <controlName>.Active = true.
 
Example:

Event 'Collapse-Simplifica-Logo'
     scaCollapse1.Active = true
     SimplificaLogo.Visible = False
     scaCollapse1.Active = false
EndEvent

 
A good practice for this case are the forms or Tips/HowTo messages would be included the button/link that triggers the event within the object to collapse. Then, once the user enters the required information, the questionnaire will disappear smoothly. 
 
Example
 
When drag the control to the form, the XPZ with three examples will be imported, one for simple flat-level elements and another one for grids.
 
Legacy Methods
 
Currently all scaCollapse functionality can be used without the need to call these methods. 
The methods were kept for compatibility purposes, in order to avoid forcing users to change what has already been implemented. The currently visible method overload is enabled by default, to turn it off you must go to control's properties dialog and set value for "Active" property to "false". To collapse a form control (or container) you can call to the Collapse method:
control.Collapse(<InternalName>)
ToWhere control is the internal name of a control to be collapsed. (eg: Table1.InternalName)

Example:

Event 'Collapse-Expand'
     scaCollapse1.Collapse(SimplificaLogo.InternalName)
Endevent

 
For elements in the grid, it is necessary to use CollapseInGrid method. (note: the event should be executed on client-side). 
control.CollapseInGrid(<InternalName>,<Row>)
Where "InternalName" was the internal name of a control
          "row" the row position in the Grid
 
Example: 

    scaCollapse1.CollapseInGrid("TABLE1", &i)

They are separated in two cases because the InternalName property is not correctly returned by GeneXus when the element is in a grid (it returns the ID without the identification of the row).
 
How to know if an element is collapsed or expanded?
control.Collapsed(<InternalName>)
or in grid case:
control.CollapsedInGrid(<InternalName>,<Row>)
 
Example:

Event 'IsCollapsed'
    if scaCollapse1.Collapsed("SIMPLIFICALOGO")
        msg("Collapsed=true")
    else    
        msg("Collapsed=false")
    endif
EndEvent