dialog with two database-supported pop-up menus.
dialog with two database-supported pop-up menus.
The function is also available in a limited versin in comet_pdf. In this case the entries of the popupEntries list are shown in the Terminal as an enumerated list and an entry can be selected by entering the list number. With the parameters title and label the list can be described additionally. Additional specifications are not supported by comet_pdf.
Please note that this call will interrupt the processing of the program until the input.
Name | Type | Default | Description |
Return | int | 0 : Cancel otherwise : Okay |
|
title | char* | "" | Window title |
okay | char* | "" | Caption of the OK button "" : "Okay" |
cancel | char* | "" | Caption of the Cancel button "" : "Cancel" |
dbc | DBC | - | Database connection over which the pop-upa are loaded |
label | char* | - | Brief caption of the popup menu. Contains the selected entrie ID at successful return. If the label contains (at any place) the marker @INDEX mValue is handled as popup index not as an ID. |
mValue | int* | - | ID of the popup to be selected. Contains the selected entrie ID (or index) at successful return. |
selectStmt | char* | - | Select to load the pop-up entry, delivers ID and name, e.g select id, name, value from domain where id > 0 |
nullEntry | char* | - | Name of the popup entry for ID 0. Empty string prevents the entry nullEntry are ignored and the popup is filled by the ID1/String pairs of this list. |
popupEntries | IDTypeList | 0 | List of ids to fill the popup. If this value is given (not 0) dbc, selectStmt and |
⇨ Second popup Entries are reloaded on selection changes in the first popup (since CS4). In this case, all <ID> tags are replaced by the current ID selected in the first popup. If this popup was filled by entriesPopup2, its not reloaded. |
|||
labelPopup2 | char* | - | Brief caption of the popup menu. If the label contains (at any place) the marker @INDEX valuePopup2 is handled as popup index not as an ID. |
valuePopup2 | int* | - | Contains the selected entrie ID (or index) at successful return. |
selectStmtPopup2 | char* | - | Selection to fill in the menu, delivers ID and name. All <ID> tags are replaced by the current ID selected in the first popup. |
nullentryPopup2 | char* | - | Name of the popup entry for ID 0. Empty string prevents the entry |
entriesPopup2 | IDTypeList | - | List of ids to fill the second popup. If this value is given (not 0) dbc, selectStmtPopup2 and nullentryPopup2 are ignored and the popup is filled by the ID1/String pairs of this list. |
Show to popup menus. The first contains all templates with subtemplates. The second popup contains the according sub templates.
#include "internal/types.h"
int main () { int id = 50; int id2 = 0; int ok; char mainTemplates [1024]; char subTemplates [1024];
strcpy (mainTemplates, "select id, name from pageitems where id > 0 and spreadid < 2"); strcpy (subTemplates, "select id, concat (name, ', Links') from pageitems where id = <ID>"); strcat (subTemplates, " union"); strcat (subTemplates, " select id, concat (name, ', Rechts') from pageitems where spreadid = 3 and leftid = <ID>"); strcat (subTemplates, " union"); strcat (subTemplates, " select id, concat (name, ', Fortsetzung-Links') from pageitems where rightid > 0 and rightid = (select id from pageitems where leftid > 0 and leftid = (select continueid from pageitems where id = <ID>))"); strcat (subTemplates, " union"); strcat (subTemplates, " select id, concat (name, ', Fortsetzung-Rechts') from pageitems where leftid > 0 and leftid = (select continueid from pageitems where id = <ID>)");
ok = askpopup2 ( "Templates importieren", "", "",
0,
"Templates", &id, mainTemplates, "", 0,
"Subtemplates", &id2, subTemplates, "", 0); if (!ok) return 0;
showmessage ("Popup1 : %d\nPopup2 : %d", id, id2);
return 0; }
Popups filled by all entries of the products panel. Index is used to identify entries.
#include "internal/types.h" #include "internal/panels.h" #include "internal/products.h"
int main () { int ix1 = 0; int ix2 = 0; int ok; IDTypeList fullIDs = idtypelist::alloc (); ProductList products = productlist::get ("list"); Product p;
for (p = productlist::first (products); p; p = productlist::next (products)) { ++ix1; idtypelist::append ( &npsb; fullIDs, &npsb; ix1, &npsb; 0, &npsb; 0, &npsb; product::gets (p, kRow1)); }
ix1 = 0; ix2 = 1; ok = askpopup2 ( "Select two products please.", "", "", 0, "Product 1@INDEX", &ix1, "", "", fullIDs, "Product 2@INDEX", &ix2, "", "", fullIDs); if (!ok) return 0;
idtypelist::get_from_panel (fullIDs, kPanelProducts, kAll);
showmessage ("Product 1 : [%d, %d, %d, '%s']", idtype::id (idtypelist::get (fullIDs, ix1)), idtype::id2 (idtypelist::get (fullIDs, ix1)), idtype::id3 (idtypelist::get (fullIDs, ix1)), idtype::stringid (idtypelist::get (fullIDs, ix1))); showmessage ("Product 2 : [%d, %d, %d, '%s']", idtype::id (idtypelist::get (fullIDs, ix2)), idtype::id2 (idtypelist::get (fullIDs, ix2)), idtype::id3 (idtypelist::get (fullIDs, ix2)), idtype::stringid (idtypelist::get (fullIDs, ix2)));
return 0; }
And here is an example for comet_pdf which produces the following output:
int main () { int res; IDTypeList li = idtypelist::alloc (); IDType id;
idtypelist::append (li, 1, 0, 0, "aaa"); idtypelist::append (li, 2, 0, 0, "bbb"); idtypelist::append (li, 3, 0, 0, "ccc"); idtypelist::append (li, 4, 0, 0, "ddd"); idtypelist::append (li, 5, 0, 0, "eee");
if (askpopup2 ( "This is a testt", "", "", 0, "Your choice", &res, 0, 0, li)) { id = idtypelist::get (li, res); printf ("Result : Index %d, Value '%s'\n", res, idtype::stringid (id)); }
return 0; }
Alphabetic index HTML hierarchy of classes or Java