INCLUDE "picktest.4gh" FORWARD Window1 INCLUDE SYSTEM "ixconn.4gh" GLOBAL VARIABLE picktestWN Window1 VARIABLE mPickListWN pickListWCL #------------------------------------------------------------------------ FUNCTION pickCodeSF(mySF ixSuperField, numRows SMALLINT) RETURNING VOID # Input: ixSuperField they did rightMouseClick from, # how many rows they can select from there (NULL for ALL) # Assumes: picklist.wif # Purpose: Use the picklist functions to popup the window # and pick from the list # Returns: N/A #------------------------------------------------------------------------ VARIABLE myST ixSuperTable VARIABLE SFString ixString VARIABLE SFname CHAR(*) VARIABLE tabName CHAR(*) VARIABLE sqlTxt CHAR(*) VARIABLE myPK CHAR(*) VARIABLE myItem CHAR(*) VARIABLE myBN ixButton VARIABLE itemSF ixSuperField # don't do it if the SF is disabled IF NOT mySF.isEnabled() THEN IF MESSAGEBOX(title: NEW ixString("NO INPUT"), message: NEW ixString ("No Input Allowed")) THEN END IF RETURN END IF # NOT mySF.isEnabled() LET myST = mySF.getSuperTable() CALL mySF.focus() LET SFString = NEW ixString("") CALL SFString.concat(mySF.name) LET SFname = SFString.getValueStr() CASE WHEN SFname = "stateSF" LET tabName = "state" LET sqlTxt = "SELECT code, sname FROM state ORDER BY sname" CALL mPickListWN.setTitle("STATES") WHEN SFname = "manuCodeSF" LET tabName = "manufact" LET sqlTxt = "SELECT manu_code, manu_name ", "FROM manufact ", "ORDER BY manu_name" CALL mPickListWN.setTitle("MANUFACTURERS") END CASE # SFname # fill the list box and return number of rows found IF mPickListWN.fillPickList(tabName, sqlTxt, numRows) > 0 THEN # put the modal popup on screen CALL mPickListWN.show() # since the window is modal, # the next line of code won't fire until the modal pick window is closed # get the value they picked, if any CALL mpickListWN.getPickList() RETURNING myPK, myItem ELSE IF MESSAGEBOX(title: NEW ixString("NOT FOUND"), message: NEW ixString ("No Rows Found")) THEN END IF LET myPK = NULL LET myItem = NULL END IF # mPickListWN.fillPickList(tabName, sqlTxt, numRows) > 0 # put the value in the SF IF myPK IS NOT NULL THEN # Put the code in the SF we picked from IF mySF.setText(myPK) THEN END IF # put the description (myItem) in the appropriate other field CASE WHEN SFname = "stateSF" LET itemSF = myST.getContainedObjByName("snameSF") WHEN SFname = "manuCodeSF" LET itemSF = myST.getContainedObjByName("manuNameSF") END CASE # SFname IF itemSF.setText(myItem) THEN END IF # If you are disabling/enabling action keys when new input is made, # do it here. Below is the code that works with my superTable Library # IF myST.getDisplayMode() = ixSuperTable::displayData THEN # # set the change flag so that the appropriate keys are enabled # IF myST.getChangeFlag(colNum: NULL) = (ixSuperTable::isNew) # OR myST.getChangeFlag(colNum: NULL) = (ixSuperTable::isNewModified) # THEN # CALL myST.setChangeFlag(changeFlag: ixSuperTable::isNewModified) # ELSE # CALL myST.setChangeFlag(changeFlag: ixSuperTable::isModified) # END IF # myST.getChangeFlag(colNum: NULL) ... # # see if we need to reset buttons for this update # CALL enableForUpdateBNs(mySF, gChemResultST) # END IF # myST.getDisplayMode() = ixSuperTable::displayData CALL mySF.focus() END IF # mypK IS NOT NULL END FUNCTION # pickCodeSF MAIN CALL ixSQLConnect::getImplicitConnection().connect("STORES6") LET picktestWN = NEW Window1() CALL picktestWN.open() RETURN END MAIN HANDLER Window1::picktestWN_start() RETURNING VOID VARIABLE rowNum INTEGER VARIABLE superTable ixSuperTable # initialize the list picker. LET mPickListWN = NEW pickListWCL(containingWindow: getWindow(), shown: FALSE, windowStyle: ixWindow::modalPopup) CALL mpickListWN.open() # open up a row for input on the test SuperTable LET superTable = getContainedObjByName("testST") LET rownum = superTable.insert() END HANDLER -- Window1::picktestWN_start HANDLER ixSuperField::picktestWN_stateSF_rightMouseClick(vertical INTEGER, horizontal INTEGER) RETURNING VOID CALL pickCodeSF(self,0) END HANDLER -- ixSuperField::picktestWN_stateSF_rightMouseClick HANDLER ixSuperField::picktestWN_manuCodeSF_rightMouseClick(vertical INTEGER, horizontal INTEGER) RETURNING VOID CALL pickCodeSF(self,0) END HANDLER -- ixSuperField::picktestWN_manuCodeSF_rightMouseClick HANDLER ixButton::picktestWN_okBN_activate() RETURNING VOID IF (getWindow()).close() THEN END IF END HANDLER -- ixButton::picktestWN_okBN_activate FUNCTION Window1::Window1( geometry ixGeometry, appearance ixAppearance, windowStyle SMALLINT, containingWindow ixWindow, title CHAR(*), enabled BOOLEAN, helpFile CHAR(*), name CHAR(*), helpNum INTEGER, source BOOLEAN, shown BOOLEAN, topicName CHAR(*), icon CHAR(*) ) : ixWindow( containingWindow : containingWindow, name : name, enabled : enabled, shown : shown, helpNum : helpNum, geometry : geometry, appearance : appearance, helpFile : helpFile, title : title, icon : icon, windowStyle : windowStyle, topicName : topicName, source : source ) VARIABLE itemList ixVector VARIABLE includeTable ixRow VARIABLE result INTEGER LET result = 0 HANDLE start WITH Window1::picktestWN_start LET testST = NEW ixSuperTable( geometry : NEW ixGeometry( top : 150, left : 165, height : 2235, width : 7440 ), appearance : NEW ixAppearance( fontName : NULL, fontSize : NULL, fontBold : NULL, fontItalic : NULL, fontUnderline : NULL, foreColor : NULL, backColor : NULL ), updateTable : "stock", numDisplayedRows : 1, maxRows : NULL, selectUnique : FALSE, numDisplayedCols : 4, enabled : TRUE, selectFromPart : "manufact, stock, state, customer", selectJoinPart : NULL, selectOrderbyPart : NULL, borderWidth : 20, name : "testST", helpNum : 0, shown : TRUE, layout : ixSuperTable::freeForm, displayMode : ixSuperTable::displayData, selectFilterPart : NULL, dbConnection : NULL, lockMode : ixSuperTable::noLock, container : SELF ) LET includeTable = NEW ixRow() LET stateSF = NEW ixSuperField( geometry : NEW ixGeometry( top : 205, left : 1913, height : 440, width : 520 ), appearance : NEW ixAppearance( fontName : NULL, fontSize : NULL, fontBold : NULL, fontItalic : NULL, fontUnderline : NULL, foreColor : NULL, backColor : NULL ), titleGeometry : NEW ixGeometry( top : 205, left : 865, height : 440, width : 728 ), titleAppearance : NEW ixAppearance( fontName : NULL, fontSize : NULL, fontBold : NULL, fontItalic : NULL, fontUnderline : NULL, foreColor : NULL, backColor : NULL ), colInfo : NEW ixColumn( type : 0, encLength : 2, nullable : TRUE, tableName : "customer", columnName : "state" ), maxDataChars : 2, title : "state", tabIndex : NULL, tabEnabled : TRUE, name : "stateSF", helpNum : 0, shown : TRUE, initialQueryValue : NULL, initialDataValue : NULL, dataState : ixSuperField::enabledState, titleJustify : ixSuperField::rightJustify, primaryKey : FALSE, SQLRole : ixSuperField::noUpdateRole, queryState : ixSuperField::enabledState, multiLine : FALSE, colNum : 1, pictureString : NULL, superTable : testST ) CALL stateSF.setFormat(NULL) CALL stateSF.setDataJustify(ixSuperField::leftJustify) CALL stateSF.setShiftPolicy(ixSuperField::noShift) LET stateSF.required = FALSE LET stateSF.verify = FALSE LET stateSF.includeTable = includeTable LET stateSF.useIncludes = FALSE LET stateSF.autoNextOn = FALSE LET stateSF.blobEditor = NULL HANDLE stateSF.rightMouseClick WITH ixSuperField::picktestWN_stateSF_rightMouseClick LET includeTable = NEW ixRow() LET snameSF = NEW ixSuperField( geometry : NEW ixGeometry( top : 205, left : 2543, height : 440, width : 2860 ), appearance : NEW ixAppearance( fontName : NULL, fontSize : NULL, fontBold : NULL, fontItalic : NULL, fontUnderline : NULL, foreColor : NULL, backColor : NULL ), titleGeometry : NEW ixGeometry( top : 145, left : 7150, height : 440, width : 68 ), titleAppearance : NEW ixAppearance( fontName : NULL, fontSize : NULL, fontBold : NULL, fontItalic : NULL, fontUnderline : NULL, foreColor : 16777215, backColor : NULL ), colInfo : NEW ixColumn( type : 0, encLength : 15, nullable : TRUE, tableName : "state", columnName : "sname" ), maxDataChars : 15, title : "sname", tabIndex : NULL, tabEnabled : TRUE, name : "snameSF", helpNum : 0, shown : TRUE, initialQueryValue : NULL, initialDataValue : NULL, dataState : ixSuperField::readOnlyState, titleJustify : ixSuperField::rightJustify, primaryKey : FALSE, SQLRole : ixSuperField::noUpdateRole, queryState : ixSuperField::readOnlyState, multiLine : FALSE, colNum : 2, pictureString : NULL, superTable : testST ) CALL snameSF.setFormat(NULL) CALL snameSF.setDataJustify(ixSuperField::leftJustify) CALL snameSF.setShiftPolicy(ixSuperField::noShift) LET snameSF.required = FALSE LET snameSF.verify = FALSE LET snameSF.includeTable = includeTable LET snameSF.useIncludes = FALSE LET snameSF.autoNextOn = FALSE LET snameSF.blobEditor = NULL LET includeTable = NEW ixRow() LET manuCodeSF = NEW ixSuperField( geometry : NEW ixGeometry( top : 745, left : 1928, height : 440, width : 700 ), appearance : NEW ixAppearance( fontName : NULL, fontSize : NULL, fontBold : NULL, fontItalic : NULL, fontUnderline : NULL, foreColor : NULL, backColor : NULL ), titleGeometry : NEW ixGeometry( top : 745, left : 235, height : 440, width : 1373 ), titleAppearance : NEW ixAppearance( fontName : NULL, fontSize : NULL, fontBold : NULL, fontItalic : NULL, fontUnderline : NULL, foreColor : NULL, backColor : NULL ), colInfo : NEW ixColumn( type : 0, encLength : 3, nullable : TRUE, tableName : "stock", columnName : "manu_code" ), maxDataChars : 3, title : "manu_code", tabIndex : NULL, tabEnabled : TRUE, name : "manuCodeSF", helpNum : 0, shown : TRUE, initialQueryValue : NULL, initialDataValue : NULL, dataState : ixSuperField::enabledState, titleJustify : ixSuperField::rightJustify, primaryKey : TRUE, SQLRole : ixSuperField::updateRole, queryState : ixSuperField::enabledState, multiLine : FALSE, colNum : 3, pictureString : NULL, superTable : testST ) CALL manuCodeSF.setFormat(NULL) CALL manuCodeSF.setDataJustify(ixSuperField::leftJustify) CALL manuCodeSF.setShiftPolicy(ixSuperField::noShift) LET manuCodeSF.required = FALSE LET manuCodeSF.verify = FALSE LET manuCodeSF.includeTable = includeTable LET manuCodeSF.useIncludes = FALSE LET manuCodeSF.autoNextOn = FALSE LET manuCodeSF.blobEditor = NULL HANDLE manuCodeSF.rightMouseClick WITH ixSuperField::picktestWN_manuCodeSF_rightMouseClick LET includeTable = NEW ixRow() LET manuNameSF = NEW ixSuperField( geometry : NEW ixGeometry( top : 745, left : 2753, height : 440, width : 2860 ), appearance : NEW ixAppearance( fontName : NULL, fontSize : NULL, fontBold : NULL, fontItalic : NULL, fontUnderline : NULL, foreColor : NULL, backColor : NULL ), titleGeometry : NEW ixGeometry( top : 790, left : 7165, height : 440, width : 68 ), titleAppearance : NEW ixAppearance( fontName : NULL, fontSize : NULL, fontBold : NULL, fontItalic : NULL, fontUnderline : NULL, foreColor : 16777215, backColor : NULL ), colInfo : NEW ixColumn( type : 0, encLength : 15, nullable : TRUE, tableName : "manufact", columnName : "manu_name" ), maxDataChars : 15, title : "manu_name", tabIndex : NULL, tabEnabled : TRUE, name : "manuNameSF", helpNum : 0, shown : TRUE, initialQueryValue : NULL, initialDataValue : NULL, dataState : ixSuperField::readOnlyState, titleJustify : ixSuperField::rightJustify, primaryKey : FALSE, SQLRole : ixSuperField::noUpdateRole, queryState : ixSuperField::readOnlyState, multiLine : FALSE, colNum : 4, pictureString : NULL, superTable : testST ) CALL manuNameSF.setFormat(NULL) CALL manuNameSF.setDataJustify(ixSuperField::leftJustify) CALL manuNameSF.setShiftPolicy(ixSuperField::noShift) LET manuNameSF.required = FALSE LET manuNameSF.verify = FALSE LET manuNameSF.includeTable = includeTable LET manuNameSF.useIncludes = FALSE LET manuNameSF.autoNextOn = FALSE LET manuNameSF.blobEditor = NULL LET okBN = NEW ixButton( geometry : NEW ixGeometry( top : 1475, left : 2995, height : 480, width : 1445 ), appearance : NEW ixAppearance( fontName : NULL, fontSize : NULL, fontBold : NULL, fontItalic : NULL, fontUnderline : NULL, foreColor : NULL, backColor : NULL ), title : "OK", enabled : TRUE, tabIndex : NULL, tabEnabled : TRUE, theDefault : FALSE, name : "okBN", helpNum : 0, shown : TRUE, container : testST ) HANDLE okBN.activate WITH ixButton::picktestWN_okBN_activate END FUNCTION -- Window1::Window1