VERSION "2.00.WC1" BEGIN ixWindow picktestWN windowStyle *= ixWindow::mainTop containingWindow *= NULL derivedFrom *= "ixWindow" rulersOn *= TRUE fontItalic *= FALSE title = "Pick Test" fontUnderline *= FALSE enabled *= TRUE backgroundColor *= NULL foregroundColor *= NULL fontName *= "System" fontSize *= 10 fontBold *= TRUE database = "STORES6" snapToGrid *= FALSE height = 2895 width = 7740 left = 0 top = 0 helpFile *= NULL classname *= "Window1" name = "picktestWN" helpNum *= 0 source *= TRUE shown *= TRUE rofID *= 0 @rofFileName *= NULL topicName *= NULL icon *= NULL theStartup = TRUE characterMode *= FALSE gridOn *= FALSE BEGIN ixSuperTable testST updateTable *= "stock" numDisplayedRows *= 1 maxRows *= NULL SVName *= NULL selectUnique *= FALSE numDisplayedCols *= 4 data_source *= tables fontItalic *= NULL fontUnderline *= NULL enabled *= TRUE backgroundColor *= NULL foregroundColor *= NULL fontName *= NULL fontSize *= NULL fontBold *= NULL height = 2235 width = 7440 left = 165 SVLevel *= NULL top = 150 selectFromPart *= "manufact, stock, state, customer" selectJoinPart *= NULL selectOrderbyPart *= NULL borderWidth *= 20 classname *= "ixSuperTable" name = "testST" helpNum *= 0 shown *= TRUE rofID *= 0 @rofFileName *= NULL layout *= ixSuperTable::freeForm displayMode *= ixSuperTable::displayData selectFilterPart *= NULL dbConnection *= NULL lockMode *= ixSuperTable::noLock BEGIN ixSuperField stateSF format *= NULL blobEditor *= NULL encLength *= 2 maxDataChars *= 2 title_BackgroundColor *= NULL includeTable *= NULL useIncludes *= FALSE title_ForegroundColor *= NULL title_FontName *= NULL title_FontSize *= NULL fontItalic *= NULL title *= "state" fontUnderline *= NULL tabIndex *= NULL tabEnabled *= TRUE backgroundColor *= NULL foregroundColor *= NULL fontName *= NULL fontSize *= NULL fontBold *= NULL height = 440 width = 520 left = 1913 top = 205 classname *= "ixSuperField" columnAlias *= NULL name = "stateSF" helpNum *= 0 title_Width = 728 title_Left = 865 shiftPolicy *= ixSuperField::noShift shown *= TRUE title_FontUnderline *= NULL title_FontItalic *= NULL rofID *= 0 title_FontBold *= NULL initialQueryValue *= NULL initialDataValue *= NULL type *= 0 dataState *= ixSuperField::enabledState dataJustify *= ixSuperField::leftJustify title_Top = 205 @rofFileName *= NULL titleJustify *= ixSuperField::rightJustify autoNextOn *= FALSE title_Height = 440 required *= FALSE primaryKey *= FALSE verify *= FALSE SQLRole *= ixSuperField::noUpdateRole nullable *= TRUE queryState *= ixSuperField::enabledState multiLine *= FALSE colNum = 1 columnName = "state" tableName = "customer" pictureString *= NULL handler rightMouseClick(vertical INTEGER, horizontal INTEGER) CALL pickCodeSF(self,0) end handler END BEGIN ixSuperField snameSF format *= NULL blobEditor *= NULL encLength *= 15 maxDataChars *= 15 title_BackgroundColor *= NULL includeTable *= NULL useIncludes *= FALSE title_ForegroundColor = 16777215 title_FontName *= NULL title_FontSize *= NULL fontItalic *= NULL title *= "sname" fontUnderline *= NULL tabIndex *= NULL tabEnabled *= TRUE backgroundColor *= NULL foregroundColor *= NULL fontName *= NULL fontSize *= NULL fontBold *= NULL height = 440 width = 2860 left = 2543 top = 205 classname *= "ixSuperField" columnAlias *= NULL name = "snameSF" helpNum *= 0 title_Width = 68 title_Left = 7150 shiftPolicy *= ixSuperField::noShift shown *= TRUE title_FontUnderline *= NULL title_FontItalic *= NULL rofID *= 0 title_FontBold *= NULL initialQueryValue *= NULL initialDataValue *= NULL type *= 0 dataState = ixSuperField::readOnlyState dataJustify *= ixSuperField::leftJustify title_Top = 145 @rofFileName *= NULL titleJustify *= ixSuperField::rightJustify autoNextOn *= FALSE title_Height = 440 required *= FALSE primaryKey *= FALSE verify *= FALSE SQLRole *= ixSuperField::noUpdateRole nullable *= TRUE queryState = ixSuperField::readOnlyState multiLine *= FALSE colNum = 2 columnName = "sname" tableName = "state" pictureString *= NULL END BEGIN ixSuperField manuCodeSF format *= NULL blobEditor *= NULL encLength *= 3 maxDataChars *= 3 title_BackgroundColor *= NULL includeTable *= NULL useIncludes *= FALSE title_ForegroundColor *= NULL title_FontName *= NULL title_FontSize *= NULL fontItalic *= NULL title *= "manu_code" fontUnderline *= NULL tabIndex *= NULL tabEnabled *= TRUE backgroundColor *= NULL foregroundColor *= NULL fontName *= NULL fontSize *= NULL fontBold *= NULL height = 440 width = 700 left = 1928 top = 745 classname *= "ixSuperField" columnAlias *= NULL name = "manuCodeSF" helpNum *= 0 title_Width = 1373 title_Left = 235 shiftPolicy *= ixSuperField::noShift shown *= TRUE title_FontUnderline *= NULL title_FontItalic *= NULL rofID *= 0 title_FontBold *= NULL initialQueryValue *= NULL initialDataValue *= NULL type *= 0 dataState *= ixSuperField::enabledState dataJustify *= ixSuperField::leftJustify title_Top = 745 @rofFileName *= NULL titleJustify *= ixSuperField::rightJustify autoNextOn *= FALSE title_Height = 440 required *= FALSE primaryKey *= TRUE verify *= FALSE SQLRole *= ixSuperField::updateRole nullable *= TRUE queryState *= ixSuperField::enabledState multiLine *= FALSE colNum = 3 columnName = "manu_code" tableName = "stock" pictureString *= NULL handler rightMouseClick(vertical INTEGER, horizontal INTEGER) CALL pickCodeSF(self,0) end handler END BEGIN ixSuperField manuNameSF format *= NULL blobEditor *= NULL encLength *= 15 maxDataChars *= 15 title_BackgroundColor *= NULL includeTable *= NULL useIncludes *= FALSE title_ForegroundColor = 16777215 title_FontName *= NULL title_FontSize *= NULL fontItalic *= NULL title *= "manu_name" fontUnderline *= NULL tabIndex *= NULL tabEnabled *= TRUE backgroundColor *= NULL foregroundColor *= NULL fontName *= NULL fontSize *= NULL fontBold *= NULL height = 440 width = 2860 left = 2753 top = 745 classname *= "ixSuperField" columnAlias *= NULL name = "manuNameSF" helpNum *= 0 title_Width = 68 title_Left = 7165 shiftPolicy *= ixSuperField::noShift shown *= TRUE title_FontUnderline *= NULL title_FontItalic *= NULL rofID *= 0 title_FontBold *= NULL initialQueryValue *= NULL initialDataValue *= NULL type *= 0 dataState = ixSuperField::readOnlyState dataJustify *= ixSuperField::leftJustify title_Top = 790 @rofFileName *= NULL titleJustify *= ixSuperField::rightJustify autoNextOn *= FALSE title_Height = 440 required *= FALSE primaryKey *= FALSE verify *= FALSE SQLRole *= ixSuperField::noUpdateRole nullable *= TRUE queryState = ixSuperField::readOnlyState multiLine *= FALSE colNum = 4 columnName = "manu_name" tableName = "manufact" pictureString *= NULL END BEGIN ixButton okBN fontItalic *= NULL title = "OK" fontUnderline *= NULL enabled *= TRUE tabIndex *= NULL tabEnabled *= TRUE backgroundColor *= NULL foregroundColor *= NULL fontName *= NULL fontSize *= NULL fontBold *= NULL height = 480 width = 1445 left = 2995 top = 1475 theDefault *= FALSE classname *= "ixButton" name = "okBN" helpNum *= 0 shown *= TRUE rofID *= 0 @rofFileName *= NULL handler activate() IF (getWindow()).close() THEN END IF end handler END END handler pre_header() INCLUDE SYSTEM "ix4gl.4gh" # picklist picker INCLUDE "picklist.4gh" end handler handler pre_body() 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 end handler handler start() 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 END