Empowered Events/Source Part

WorkWithPlus has created a new Part for the Events named 'Events (by WorkWithPlus)' so that you can develop faster and simpler. 

This empowered Event Part contains the following features:

 

Tooltip over elements

If you place the mouse/cursor over a Procedure it will display the parameters that it needs.

If you place it in a variable, it will display the definition of it.

If you place it in the call of a subroutine, it will display the code of it.

A code editor shows the 'DoAssignExam' event with a For loop iterating &SelectedRow in &SelectedRows, calling &isOk=AssignStudentToExam(&SelectedRow.PersonId), with a tooltip displaying the procedure signature 'Assign Student To Exam' parm(in:&PersonId (Numeric), out:&isOk (Boolean))', followed by an Else branch calling msg('There was an error in the process').     A code editor shows the 'DoAssignExam' event with a For loop iterating &SelectedRow in &SelectedRows, where a tooltip for 'Selected Row' displays its type 'SDT (PersonWWSDT.PersonWWSDTItem)', followed by branches msg('Student successfully assigned to exam') and msg('There was an error in the process').
 

New options in the toolbar

GeneXus Events code editor for a WorkWithPlus grid, listing Event Start, Event Refresh, and Event Grid.Load (each with only a generated-code placeholder comment), followed by Event 'DoAssignExam' calling Do 'AssignPersonExam', and a Sub 'AssignPersonExam' that loops For &SelectedRow in &SelectedRows, calls AssignStudentToExam(&SelectedRow.PersonId) into &isOk, and shows a success or error msg() based on the result.

The following options were added to the toolbar:

 

Collapse/expand all events and subroutines

It collapses all the Events and Subroutines of the Part. If you hover on a collapsed event or subroutine, the hidden code will appear as a tooltip.

 

Show/hide generated code

It will show or hide the code generated by WorkWithPlus. When it hides, a comment will appear:

/* Generated code position - Do not remove */

If you hover on the comment, the hidden code will appear as a tooltip.

 

Sort custom events and subroutines

It sorts alphabetically the events and subroutines that are not generated by WorkWithPlus.

 

Format code

When clicking on this option WorkWithPlus will:

  • Format the indentations
  • Fix the casing of the variables, reserved words (If, Else, Endif, etc.), standard functions, and calls to subroutines. 

Two stacked code editor views of the WwP_DFC_Text_WC object's 'Events (by WorkWithPlus)' tab, both showing the 'Load title and metadata' event with generated code assigning &data.Caption and branching on WWPFormElementDataType (Numeric, Character, Password). Red arrows and the label 'After pressing Format code' highlight how the indentation and line wrapping of the same code differ between the top (before) and bottom (after) versions once the Format code toolbar button is used.

 

Extract code to sub or procedure

It will extract the code in a new subroutine or in a new procedure and add the call to the sub or procedure. In the scenario of extracting the code to a procedure case, it will define all the used variables and add the parm rule.

A code editor shows the 'DoAssignExam' event code selected (highlighted in blue), with a right-click context menu open listing options Function, Event, Command, and, highlighted by a red arrow, 'Extract procedure...' and 'Extract subroutine...', along with standard edit commands like Cut, Copy, Indent, and Comment Selection.
 

Define variables on the fly

After writing down the name of the variable, press ':' and the type of the new variable to define.

A code editor shows the 'DoAssignExam' event calling the 'LoadSelectedRows' subroutine and checking If &SelectedRows.Count = 0 to show msg('WWP_NoRecordSelected'), followed by a 'SetDDOSortedStatus' sub that sets DDO_Grid.SortedStatus based on &OrderedBy and &OrderedDsc, all marked as generated by the DVelop Work With Plus Pattern.
 

Rename variables

You can rename a variable, and it will update its name in all the Parts that this element is present (Web Form, Events, Rules, etc.). If the object is generated by an instance associated with the same object (Example: WebPanel1 and its instance is WorkWithPlusWebPanel1), it will also update the variable in the instance.

A code editor shows the 'DoAssignExam' event with a right-click context menu open over the code, highlighting the 'Rename variable' option with a red arrow, above other commands like Cut, Copy, Paste, Delete, Open, References, and Properties.

 

Rename subs

You can rename a sub, and it will update in all Events that the subroutine is called.

 

Suggestions to call subs

When you write down Do ', a list of the defined subroutines of that object will appear so that you can select the one you want to call.

GeneXus code editor showing event 'DoAssignExam' with a For loop over &SelectedRows calling AssignStudentToExam and messaging success or error; below it, typing "Do '" opens an autocomplete list of subroutine names including 'Add all records', CheckSecurityForActions, CleanFilters, Do Delete, Do Update, DoExport, DoExportReport, GetIndexOfSelectedRow, InitializeColumnsSelector, and LoadGridState.

 

Suggestions when using an enum variable

When you write down a variable that is based on a domain with enumerated values, and then continue the sentence with an operator ('=', or '<>'), WorkWithPlus will suggest the name of the domain so that you select the option value. 

GeneXus code editor on the 'Events (by WorkWithPlus)' tab, showing an empty EndEvent block, an 'Event Block (Enter)' collapsed region, an 'Event Block (Settings_Modal.Close)' collapsed region, and the start of subroutine 'Validate elements conditions' with an If &WWPDynamicFormMode = TrnMode.Insert check setting &HasDeletedElements.

 

Automatic ‘Do Case’ for domains

When you are defining a 'Do Case', and you write down a case that depends on an enumerated variable option, WorkWithPlus will automatically create all the cases for the rest of the enumerated options

An animated capture of the GeneXus "Events (by WorkWithPlus)" code editor shows an Else branch creating a WCWWP_DynamicFormFS_WC object via WWP_DFC_FS_WC.Create, followed by a conditional check on &HttpRequest.Method and &WWPForm.WWPFormTitle.IsEmpty() that calls Settings_Modal.Confirm(). Below, collapsed nodes list Event Block (Enter), Event Block (Settings_Modal.Close), and Sub Block (Validate elements conditions).

 

Subs references

You can right-click over a subroutine definition and select 'References' and in the Output, you will visualize all its references in order to click on them.

GeneXus IDE code editor for object WWP_DF_Text_WC on the 'Events (by WorkWithPlus)' tab, showing the 'Load title and metadata' subroutine with a generated comment '/* Generated by DVelop Work With Plus Pattern <a href='Start'>Start</a> - Do not change */' and code assigning &WWPFormElementTitle to DataTitle.Caption when &WWPFormElementCaption equals Title.

 

Variables references

You can right-click over a variable and select 'References' and in the Output, you will visualize all its references in order to click on them (in the same way as the subs references).

 

Control + click (or F12) for navigating subroutine

You can press Control + click (or F12) on the call of a subroutine, and WorkWithPlus will navigate to the subroutine definition.

In Visual Studio, the WWP_DF_Text_WC object's "Events (by WorkWithPlus)" tab shows the Start event with a log.Error call, setting &IsElementFocusable to True, and a "For Each WWPForm.Element" loop that matches WWPFormId, WWPFormVersionNumber, and WWPFormElementId to assign WWPFormElementTitle, WWPFormElementMetadata, and WWPFormElementCaption.