Greetings, |
Re: How to prevent opening a Dialog Box if already open? Since you cannot iterate over all open dialog boxes, you need to use some global variable or any object that won't change it's state during two runs of a DXL program. You could use the config area to store a temporary file, install a global variable using evalTop_ , use any COM object which will signal you that your dialog box is already open. Regards, Mathias |
Re: How to prevent opening a Dialog Box if already open? Mathias Mamsch - Fri Apr 23 12:21:39 EDT 2010
Great Advice, I don't know how the stuff you mentioned work, but it gave me the following IDEA. Please take a look and let me know what do you think, or maybe if you have examples of those API integration, i can figure out something. AttrDef ad Module m = current Skip attrList = createString() Buffer bAttr = create() string temp string attrName string arr [] = {} DB dbAttr DBE lstAttr int count int num //checkingInstancesofCRTool() function global variables string location = "c:/Temp/" string fName = "dbLock.txt" string path = location fName string winLock = "CR Tool currently running an instance." void checkingInstancesofCRTool() { bool canWriteStream = canOpenFile(path, false) if(canWriteStream) { string val = readFile(path) if(val == winLock) { ack(winLock) if(confirm("Are you running an instance of the CR Tool?")) { halt } else { deleteFile(path) Stream out = write(path) out << winLock close(out) flush(out) } } } else { Stream out = write(path) out << winLock close(out) flush(out) } } void getAttrList (){ if(null m){ infoBox"Program must be run from a module" } else { for ad in m do { if ((ad.object) && (!ad.system)) { attrName = ad.name if((attrName == "RTF NonShpPict") || (attrName == "RTF ShpPict")) { attrName = null } else { put(attrList, attrName, attrName) } } } } num = 0 for attrName in attrList do { insert(lstAttr, num, (string key attrList), iconNone) set(lstAttr,num, 1, num"") num++ } delete(attrList) delete(bAttr) } void insLstView (DB Win) { attrName = null int i bool getAttr count = 0 for(i = 0; i<noElems(lstAttr); i++) { getAttr = getCheck(lstAttr, i) if(getAttr) { attrName = get(lstAttr, i) print attrName"\n" col = insert (column count) attribute(col, attrName) width(col, 200) count ++ } } } void closedbWin(DB Win) { hide(dbAttr) destroy(dbAttr) deleteFile(path) } void main_form_init() { dbAttr = create("Attribute List", styleCentered|styleFixed) lstAttr = listView(dbAttr, listViewOptionCheckboxes, 425, 10, arr) apply(dbAttr, "Insert", insLstView) close(dbAttr, true, closedbWin) realize(dbAttr) insertColumn(lstAttr, 0, "Select the attributes you want to update", 250, iconNone) insertColumn(lstAttr, 1, "Column Value", 150, iconNone) getAttrList() show (dbAttr) } checkingInstancesofCRTool() main_form_init |
Re: How to prevent opening a Dialog Box if already open? SystemAdmin - Fri Apr 23 16:42:41 EDT 2010
Great Advice, I don't know how the stuff you mentioned work, but it gave me the following IDEA. Please take a look and let me know what do you think, or maybe if you have examples of those API integration, i can figure out something. AttrDef ad Module m = current Skip attrList = createString() Buffer bAttr = create() string temp string attrName string arr [] = {} DB dbAttr DBE lstAttr int count int num //checkingInstancesofCRTool() function global variables string location = "c:/Temp/" string fName = "dbLock.txt" string path = location fName string winLock = "CR Tool currently running an instance." void checkingInstancesofCRTool() { bool canWriteStream = canOpenFile(path, false) if(canWriteStream) { string val = readFile(path) if(val == winLock) { ack(winLock) if(confirm("Are you running an instance of the CR Tool?")) { halt } else { deleteFile(path) Stream out = write(path) out << winLock close(out) flush(out) } } } else { Stream out = write(path) out << winLock close(out) flush(out) } } void getAttrList (){ if(null m){ infoBox"Program must be run from a module" } else { for ad in m do { if ((ad.object) && (!ad.system)) { attrName = ad.name if((attrName == "RTF NonShpPict") || (attrName == "RTF ShpPict")) { attrName = null } else { put(attrList, attrName, attrName) } } } } num = 0 for attrName in attrList do { insert(lstAttr, num, (string key attrList), iconNone) set(lstAttr,num, 1, num"") num++ } delete(attrList) delete(bAttr) } void insLstView (DB Win) { attrName = null int i bool getAttr count = 0 for(i = 0; i<noElems(lstAttr); i++) { getAttr = getCheck(lstAttr, i) if(getAttr) { attrName = get(lstAttr, i) print attrName"\n" col = insert (column count) attribute(col, attrName) width(col, 200) count ++ } } } void closedbWin(DB Win) { hide(dbAttr) destroy(dbAttr) deleteFile(path) } void main_form_init() { dbAttr = create("Attribute List", styleCentered|styleFixed) lstAttr = listView(dbAttr, listViewOptionCheckboxes, 425, 10, arr) apply(dbAttr, "Insert", insLstView) close(dbAttr, true, closedbWin) realize(dbAttr) insertColumn(lstAttr, 0, "Select the attributes you want to update", 250, iconNone) insertColumn(lstAttr, 1, "Column Value", 150, iconNone) getAttrList() show (dbAttr) } checkingInstancesofCRTool() main_form_init |
Re: How to prevent opening a Dialog Box if already open? I'd have the script create a dynamic pre-close module trigger that closes the Dialog when the module closes. I'd have the main script plow though all the triggers in that module looking for this particular dynamic pre-close module trigger, and if it finds it then it ends without displaying the main dialog.
|
Re: How to prevent opening a Dialog Box if already open? llandale - Wed Jun 09 13:57:17 EDT 2010
|