How to change the application's state in run time

How to change the application's state in run time

To change the properties of application execution, changing their form of execution than initially planned, Scriptcase has a macro called sc_apl_conf. The macro should be used as follows:

sc_apl_conf ( Application , property , value ) ;

So, we can force a form to start the inclusion mode , or start a query by the filter , etc. .

The macro can be used by on an application to modify the properties of another application . For example , in a register of request, a Seller may register a new request, but can not change it, this case, we would use a type button "PHP", the code below for register a request.

if ( [ users ] == " Seller " )
{
     sc_apl_conf ( " apl_request_register " , "update " , "off " ) ;
     sc_redir ( apl_request_register.php ) ;
}else{
     sc_redir ( apl_request_register.php ) ;
}

 

Below is a table with the properties and values of the macro :

 

Properties for Form applications

 

Properties
Value
Description
start
new
Force the form to open in mode for inclusion of new record
insert
on/off
Enables (on) or disables (off) the inclusion of new records
update
on/off
Enables (on) or disables (off) the change of records
delete
on/off
Enables (on) or disables (off) the exclusion of records
field_display_off
field
Disables the display of a field
field_display_on
field
Enables the display of a field
field_readonly
field

Force a field to be displayed as "readonly"

rows
 
Force the amount of lines per page (for only forms multiple lines)
rows_ins
 
Force the amount of lines of inclusion (for only forms multiple lines)

 

 

Properties for Grid applications

 

Properties
Value
Description
start
filter
Force the grid initiate from filter.
cols
 
Force the amount of columns (grids of type vertical and slide)
rows
 
Force the amount of lines per page
lig_edit
on/off
Enables (on) or disables (off) the button to edit the registry (pencil)

 

Properties for all applications

 

Properties
Value
Description
exit
apl/url
Force the application exit to the "application" or "url" informed

 

Below are some examples:

 

Ex1: Force the "my_form" application Starting in the inclusion mode.

sc_apl_conf("meu_formulario", "start", "new");

 

Ex2: Do not allow the "my_form" application, make adding new records.

sc_apl_conf("my_form", "insert", "off");

 

Ex3: Displays the "my_field" field of the "my_form" application dynamically.

sc_apl_conf("my_form", "field_display_off", "my_field");

 

Force the "my_consult" application Starting from filter

 

Ex4: Force the "my_grid" application Starting from the filter.

sc_apl_conf("my_grid", "start", "filter");

 

Ex5: Force the "my_grid" application show 20 lines.

sc_apl_conf("my_grid", "rows", "20");

 

Ex6: Forcing application exit "my_grid" for the application "other_grid".

sc_apl_conf("my_grid", "exit", "other_grid");

    • Related Articles

    • Change Time Zone in the php.ini

      Many times we find ourselves in the situation that the time zone configured by the tool does not correspond to our area, so we proceed to change it in the Configuration: Options > Settings: The problem is when the changes are not saved, then, what we ...
    • Change user "admin" permissions

      Many times it happens that we modify the permissions of the admin user, and when wanting to verify some configurations or when wanting to modify some characteristics of the ScriptCase we can not have access since the permissions were changed. So what ...
    • How to change the width of your application.

      There's 2 main way's of changing the width of the application. 1. The first one is the more intuitive option, first go to Layout on your application side menu and click on Pages:  1.1. In this screen you shall see the minimum and maximum tab width's ...
    • Dynamically change the theme of a project with the sc_set_theme macro

      Scriptcase provides macros, functions created by the developers of Scriptcase, which will assist in customizing applications as well as simplifying code editing at events. In this article, we will see how to use the sc_set_theme macro in practice, to ...
    • How to change the log module table

      After creating the Scriptcase log module, it is possible to change the table. When making this change, a new table will be created from scratch with no records. The records in the previous table must be migrated to your database. How to edit log ...