« Back

How to implement result windows after analysis?

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
How to implement result windows after analysis?
community documentation query adoscript
Answer
27/03/14 12:34
The tool will perform user requested analysis on the models. Analysis results have to be represented in a window which has a basic support for icons and preferably text colouring.
Dialogues "browser", "output window" and “TreeListBox" from the AdoScript message port have been tested but none of them have the functionality required. "Browser" does not support inserting icons and can't be used to invoke an AdoScript, i.e. selecting or double-clicking a row (analysis result in our case) and running a script which will take user to the problem on the model. The "Output window" is not supposed to support icons, but with some extra functionality it might suffice as a solution to this particular use-case. This extra functionality is text colouring (e.g. warnings - yellow text, errors - red) and a function for scripts to close the output window (such functionality is not in the administrator's documentation). Also some kind of link functionality inside the output window would be great; if a user clicks on one of the links a script is executed. "TreeListBox" could be used to solve our problem, which is the closest dialogue to what we need, but it does not allow using custom icons for parent and child items.

RE: How to implement result windows after analysis?
Answer
08/03/13 12:27 as a reply to Anonymous.
TreeListBox seems to be the correct choice, icons can be integrated as
bitmap: ”C:\\mypath\\mybitmap.bmp” and bitmap2:”C:\\mypath\\mybitmap2.bmp” in case the bitmap should change, when selected.
As every other file the bitmap can be stored in the database and received with bitmap: “db:\\mybitmap.bmp”.

Attached find a sample code snippet that includes the requirements, multiple selection can be caught and resolved afterwards in ADOscript.
The sample introduces a tree box, allows multiple selections, has two colums, and uses own bitmaps to show the tree.
Selections are caught by ADOscript to trigger the appropriate scripts.

# create the main TreeListBox with all its parameters
CC "AdoScript" TLB_CREATE title:"My title" oktext:"Close" canceltext:"No way!"
boxtext:"These are my entries" no-help:1 button-w:60 columns:2 multi-sel:99
max-w:500 max-h:367 min-w:200 min-h:150

# insert some entries (as you like - ID should be unique)
CC "AdoScript" TLB_INSERT id:1 is-parent:1 text:"Root"
CC "AdoScript" TLB_INSERT id:2 parentid:1 bitmap:"C:\\mypath\\first.bmp" bitmap2:"C:\\mypath\\second.bmp" text:"selection - 1 \t aaa

CC "AdoScript" TLB_INSERT id:4 parentid:2 bitmap:"C:\\mypath\\first.bmp" bitmap2:"C:\\mypath\\second.bmp" text:"selection - 3 \t bbb

CC "AdoScript" TLB_INSERT id:3 parentid:1 text:"selection - 2 \t aaa"

# select the first entry (here: check it)
CC "AdoScript" TLB_SELECT id:1 select:1

# and finally show it
CC "AdoScript" TLB_SHOW
IF (ecode = 0) {
CC "AdoScript" INFOBOX ("Selected ids: " + selectedids + "\n" +
"You pushed the following button: " + endbutton)
} ELSE {
CC "AdoScript" INFOBOX ("You cancelled the dialog!")
}


Extension to previous example using TLB_INSERT

CC "AdoScript"
TLB_INSERT id:intValue text:strValue [ parentid:intValue] [ is-parent:boolValue] [ bitmap:strValue ] [ bitmap2:strValue ] .
-->RESULT ecode:intValue .


id: unique identifier of the new entry
text: text to be displayed
parentid: The parameter specifies the parent entry of the new entry. This is how you create the tree-like structure.
If you do not specify this parameter, the entry is inserted as a root entry.
is-parent: to define if subentries or not as boolean
0: The new entry is a leaf (has no subentries).
1: The new entry is a parent (can be expanded).
Parents are displayed with a folder icon () or defined bitmap

bitmap: Name of a graphics file. The graphics is used as icon for the new entry.
All common bitmap file types are supported, e.g. png, gif, bmp.
The dimensions of the bitmap should be 16x16 (pixels). With other dimensions the bitmap is stretched to 16x16 automatically.

bitmap2 : Name of a graphics file. The graphics is used as icon for the new entry when the entry is in expanded state.

ecode: Error codes
0: no error occurred
2: you have to call TLB_CREATE before calling this function
3: an argument is missing
4: you passed an invalid (already existing) ID