dialog with a maximum of two entry fields and two database-supported pop-up menus.

dialog with a maximum of two entry fields and two database-supported pop-up menus. The fields can be made individually invisible. The dialog will be automatically arranged again.

Name Type Default Description
Return int   0 : Cancel

otherwise : Okay
str1 String or char* - Start text of the first entry field, with Okay current content of the first entry field
label1 String or char* - Short caption of the first entry field
enabled1 int - Is the first field visible (>0) or is it to be invisible (0)?
str2 String or char* - Start text of the second entry field, with Okay current content of the second entry field
label2, String or char* - Short caption of the second entry field
enabled2, int - Is the second field visible (>0) or is it to be invisible (0)?
dbc DBC - Database connection over which the pop-up is to be loaded
selectStmt String or char* - Select to load the pop-up entry, delivers ID and name, e.g select id, name, value from domain where id > 0
nullEntry String or char* - Name of the popup entry for ID 0. Empty string prevents the entry
mValue int* - ID of the popup to be selected. Contains the selected entrie ID at successful return.
label3 String or char* - Brief caption of the popup menu.
enabled3 int - Is the popup visible (>0) or is to to be invisible (0)?
title String or char* "" Window title
okay String or char* "OK" Caption of the OK button
cancel String or char* "Cancel" Caption of the Cancel button
maxchars1 int 0 max. input length for str1, that must allocated with 1 byte more for the closing 0 at least!
maxchars2 int 0 max. input length for str2, that must allocated with 1 byte more for the closing 0 at least!
popupEntries IDTypeList 0 List of ids to fill the popup. If this value is given (not 0) dbc, selectStmt and nullEntry are ignored and the popup is filled by the ID1/String pairs of this list.
⇨ 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.
selectStmtPopup2 String or char* 0 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 String or char* 0 Name of the popup entry for ID 0. Empty string prevents the entry
valuePopup2 int* 0 Contains the selected entrie ID (or index) at successful return.
labelPopup2 String or 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.
showPopup2 int 0 Is the popup visible (>0) or is to to be invisible (0)?
entriesPopup2 IDTypeList 0 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.
Preconditions
#include "internal/types.h"

#include "internal/types.h"
int main () { String s1 = string::alloc("Text 1"); String s2 = string::alloc("Text 2"); int id = 3; // will be 'δ' from lli int ok; int enable1 = 1; int enable2 = 1; int enable3 = 1; IDTypeList lli = idtypelist::alloc ();
idtypelist::append (lli, 1, 0, 0, "α"); idtypelist::append (lli, 2, 0, 0, "β"); idtypelist::append (lli, 3, 0, 0, "γ"); idtypelist::append (lli, 4, 0, 0, "δ"); idtypelist::append (lli, 5, 0, 0, "ε");
ok = askstring2 (   s1, "This is label 1", enable1,   s2, "This is label 2", enable2,   0, 0, "",   &id, "Popupmenu-Label", enable3,   "My title", "-Okay-", "-Cancel-",   0, 0,   lli); if (!ok) return 1;
showmessage ("1: <%s>\r2: <%s>\r3: %d", s1, s2, id);
string::release(s1); string::release(s2); idtypelist::release (lli);
return 0; }

This examples shows a valid Load library script (Panelstatement 124, ) : All library files of a given folder are shown in the popup menu of the dialog.

#include "internal/types.h"
int main () { char t1 [412]; char t2 [412]; int id = 0; int ok; char destPath[4000]; char path [4000]; char ext [256]; IDTypeList ids = idtypelist::alloc (); int i, ix = 0;
strcpy (t1, ""); strcpy (t2, ""); strcpy (destPath, "$DESKTOP/MyLibraries"); for (i = 0; i < file::count (destPath); i++) { strcpy (path, file::get_nth (destPath, i)); file::extender (ext, path); if (strcmp (ext, "indl") == 0) { idtypelist::append (ids, ix, 0, 0, path); ix = ix +1; } }
ok = askstring2 (   t1, "", 0, // Text1   t2, "", 0, // Text2   0, "", "", // Popup via DB   &id, "Bibliothken", 1,   "Bibliothek importieren", "", "",   -1, -1,   ids); if (!ok) return 0;
strcpy (path, idtype::stringid (idtypelist::get (ids, id)));
library::open (path);
return 0; }

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 () { char t1 [412]; char t2 [412]; int id = 59; int id2 = 0; int ok; char mainTemplates [1024]; char subTemplates [1024];
strcpy (t1, "Text1"); strcpy (t2, "Text2"); 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"); strcat (subTemplates, " and rightid = (select id from pageitems where leftid > 0"); strcat (subTemplates, " and leftid = (select continueid from pageitems where id = <ID>))"); strcat (subTemplates, " select id, concat (name, ', Fortsetzung-Links') from pageitems where rightid > 0"); strcat (subTemplates, " and rightid = (select id from pageitems where leftid > 0"); strcat (subTemplates, " 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"); strcat (subTemplates, " and leftid = (select continueid from pageitems where id = <ID>)");
ok = askstring2 (   t1, "Beschriftung Text1", 0, // Text1   t2, "Beschriftung Text2", 0, // Text2   0, mainTemplates, "",   &id, "Templates", 1, // Popup1   "Templates importieren", // Dialog-Titel   "", "", // Buttons   -1, -1,   0,   subTemplates, "", &id2, "Subtemplates", 1, 0); // Popup2 if (!ok) return 0;
showmessage ("Popup1 : %d\nPopup2 : %d", id, id2);
return 0; }

An example with IDTypeLists to fill the popups ypou will find under askpopup2.

 

Since
1.0.16
Parameter maxchars1 since Version 1.3.4 (R172)
Parameter maxchars2 since Version 1.3.4 (R172)
Parameter sonce popupEntries since Version 3.2.2 R2364, 19. March 2011 @INDEX seit Version 3.2.2 R2384, 11.04.2011

Available
priint:comet InDesign® Plug-Ins, comet_pdf

Alphabetic index HTML hierarchy of classes or Java