scaCollapse

Control Description

scaCollapse is a multi-purpose GeneXus User Control created for expanding and collapsing elements on the form. For example, you can create an accordion, collapsible list, feedback form and much more.

Compatibility

Web

Using the control

The control can be used for any element present on the web form and can be applied for a grid, table, image, textblock, variable etc.
Very simple to use, you just need to include this User Control into 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.
 
In addition, you can choose the effect to be applied while the element is being collapsed. To do this, you have the "Effect" property at 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 effects 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 the case of forms or Tips/HowTo messages would be to include the button/link that triggers the event within theobject to collapse. So, once the user enters the required information, the questionnaire will disappear smoothly. 
 
Example
 
When dragging the control to the form and 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.

Events 
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.
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)
Where 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 on grids, you need 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 returned properly 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