Greg Haberek - xControls - redraw issue in a complicated window?
- Posted by Jonas Temple <jtemple at yhti.net> Sep 07, 2005
- 929 views
Greg, Hopefully you're still around...and still working on xControls! I've got a program with multiple windows with size/placement handled by xControls. The attached program shows what the UI should look like. The problem is when the vertical splitter is moved the controls under the "DB2" tab disappear. They re-appear when the "IFS" tab is selected. Am I doing something wrong or is this a limitation of xControls? Thanks for your help!
include Win32lib.ew include TBAR_XPM.E include xControls.ew include appsmall.e -------------------------------------------------------------------------------- -- Window Main global constant Main = createEx( Window, "F.R.O.G. for IBM iSeries DB2", 0, 0, 0, 400, 300, 0, 0 ) setIcon( Main,"iseries.ico") global constant FileM = createEx( Menu, "File", Main, 0, 1, 0, 0, 0, 0 ) global constant FileNewM = createEx( Menu, "&New", FileM, 0, 0, 0, 0, 0, 0 ) global constant NewIFSFileMI = createEx( MenuItem, "&IFS File", FileNewM, 0, 0, 0, 0, 0, 0 ) global constant FileOpenMI = createEx( MenuItem, "&Open", FileM, 0, 0, 0, 0, 0, 0 ) global constant FileSaveMI = createEx( MenuItem, "&Save", FileM, 0, 0, 0, 0, 0, 0 ) setEnable( FileSaveMI, w32False ) global constant FileSaveAsMI = createEx( MenuItem, "Save &As", FileM, 0, 0, 0, 0, 0, 0 ) setEnable( FileSaveAsMI, w32False ) global constant FileExitMI = createEx( MenuItem, "Exit", FileM, 0, 2, 0, 0, 0, 0 ) global constant EditM = createEx( Menu, "&Edit", Main, 0, 0, 0, 0, 0, 0 ) global constant EditUndoMI = createEx( MenuItem, "&Undo", EditM, 0, 0, 0, 0, 0, 0 ) setEnable( EditUndoMI, w32False ) global constant EditCopyMI = createEx( MenuItem, "&Copy", EditM, 0, 0, 0, 0, 0, 0 ) setEnable( EditCopyMI, w32False ) global constant EditCutMI = createEx( MenuItem, "Cu&t", EditM, 0, 0, 0, 0, 0, 0 ) setEnable( EditCutMI, w32False ) global constant EditPasteMI = createEx( MenuItem, "&Paste", EditM, 0, 0, 0, 0, 0, 0 ) setEnable( EditPasteMI, w32False ) global constant EditSelectAllMI = createEx( MenuItem, "&Select All", EditM, 0, 0, 0, 0, 0, 0 ) setEnable( EditSelectAllMI, w32False ) global constant OptionsM = createEx( Menu, "Options", Main, 0, 6, 0, 0, 0, 0 ) global constant PreferencesMI = createEx( MenuItem, "Preferences", OptionsM, 0, 7, 0, 0, 0, 0 ) global constant HelpM = createEx( Menu, "Help", Main, 0, 3, 0, 0, 0, 0 ) global constant HelpContentsMI = createEx( MenuItem, "Contents", HelpM, 0, 4, 0, 0, 0, 0 ) global constant HelpAboutMI = createEx( MenuItem, "About", HelpM, 0, 5, 0, 0, 0, 0 ) global constant MainTB = createEx( ToolBar, "", Main, 0, 0, 812, 34, 0, 0 ) global constant MainSB = createEx( StatusBar, "", Main, 0, 0, 0, 0, 0, 0 ) global constant SysPopupPM = createEx( Popup, "SysPopupPM", Main, 0, -700, 0, 0, 0, 0 ) global constant SysNewPI = createEx( MenuItem, "New", SysPopupPM, 0, -701, 0, 0, 0, 0 ) global constant SysConnectPropPI = createEx( MenuItem, "Set Connection &Properties", SysPopupPM, 0, -702, 0, 0, 0, 0 ) global constant SysConnDiscPI = createEx( MenuItem, "&Connect", SysPopupPM, 0, -703, 0, 0, 0, 0 ) global constant SysPropsPI = createEx( MenuItem, "&Properties", SysPopupPM, 0, -704, 0, 0, 0, 0 ) global constant SysFindPI = createEx( MenuItem, "&Filter", SysPopupPM, 0, -705, 0, 0, 0, 0 ) global constant SysEditLiblPI = createEx( MenuItem, "Edit &Library List", SysPopupPM, 0, -706, 0, 0, 0, 0 ) global constant SysExecCmdPI = createEx( MenuItem, "E&xecute Command", SysPopupPM, 0, -707, 0, 0, 0, 0) global constant SysClosePI = createEx( MenuItem, "Cl&ose Open File", SysPopupPM, 0, -708, 0, 0, 0, 0) global constant SysRefreshPI = createEx( MenuItem, "&Refresh", SysPopupPM, 0, -709, 0, 0, 0, 0 ) global constant SysWrkMgtM = createEx( Menu, "&Work Management", SysRefreshPI, 0, -710, 0, 0, 0, 0 ) global constant SysMsgsPI = createEx( MenuItem, "&Messages", SysWrkMgtM, 0, -711, 0, 0, 0, 0 ) global constant SysJobsPI = createEx( MenuItem, "&Jobs", SysWrkMgtM, 0, -712, 0, 0, 0, 0 ) global constant SysPrintersPI = createEx( MenuItem, "&Printers", SysWrkMgtM, 0, -713, 0, 0, 0, 0 ) global constant SysSrvJobsPI = createEx( MenuItem, "&ServerJobs", SysWrkMgtM, 0, -714, 0, 0, 0, 0 ) global constant SysSplfPI = createEx( MenuItem, "&Spooled Files", SysWrkMgtM, 0, -715, 0, 0, 0, 0 ) global constant LibPopupPM = createEx( Popup, "LibPopupPM", Main, 0, -100, 0, 0, 0, 0 ) global constant LibPropsPI = createEx( MenuItem, "&Properties", LibPopupPM, 0, -101, 0, 0, 0, 0 ) global constant LibRefreshPI = createEx( MenuItem, "&Refresh", LibPopupPM, 0, -102, 0, 0, 0, 0 ) global constant FilePopupPM = createEx( Popup, "FilePopupPM", Main, 0, -300, 0, 0, 0, 0 ) global constant FilePropsPI = createEx( MenuItem, "&Properties", FilePopupPM, 0, -301, 0, 0, 0, 0 ) global constant FileViewPI = createEx( MenuItem, "&View", FilePopupPM, 0, -302, 0, 0, 0, 0 ) global constant FileGenDDLPI = createEx( MenuItem, "&Generate Definition Language", FilePopupPM, 0, -303, 0, 0, 0, 0 ) global constant FileRefreshPI = createEx( MenuItem, "&Refresh", FilePopupPM, 0, -304, 0, 0, 0, 0 ) global constant LVPopupPM = createEx( Popup, "LVPopupPM", Main, 0, -400, 0, 0, 0, 0 ) global constant InsertPrefixPI = createEx( MenuItem, "Insert with prefix", LVPopupPM, 0, -401, 0, 0, 0, 0 ) global constant Level2popup_101 = createEx( Menu, "Insert As", InsertPrefixPI, 0, -402, 0, 0, 0, 0 ) global constant InsertAsAvgPI = createEx( MenuItem, "avg()", Level2popup_101, 0, -403, 0, 0, 0, 0 ) global constant InsertAsCountPI = createEx( MenuItem, "count()", Level2popup_101, 0, -404, 0, 0, 0, 0 ) global constant InsertAsMaxPI = createEx( MenuItem, "max()", Level2popup_101, 0, -405, 0, 0, 0, 0 ) global constant InsertAsMinPI = createEx( MenuItem, "min()", Level2popup_101, 0, -406, 0, 0, 0, 0 ) global constant InsertAsStdDevPI = createEx( MenuItem, "stddev()", Level2popup_101, 0, -407, 0, 0, 0, 0 ) global constant InsertAsSumPI = createEx( MenuItem, "sum()", Level2popup_101, 0, -408, 0, 0, 0, 0 ) global constant InsertAsVarPI = createEx( MenuItem, "var()", Level2popup_101, 0, -409, 0, 0, 0, 0 ) global constant ShiftColumnPI = createEx( MenuItem, "Shift to Column", LVPopupPM, 0, -410, 0, 0, 0, 0 ) global constant ColumnsToCSVPI = createEx( MenuItem, "Export Column Info", LVPopupPM, 0, -411, 0, 0, 0, 0 ) global constant StatementREPM = createEx( Popup, "StatementREPM", Main, 0, -500, 0, 0, 0, 0 ) global constant SendToQMToolPI = createEx( MenuItem, "Send to QM Tool", StatementREPM, 0, -501, 0, 0, 0, 0 ) global constant SaveSQLStmtPI = createEx( MenuItem, "Save SQL Statement", StatementREPM, 0, -502, 0, 0, 0, 0 ) global constant OpenSQLStmtPI = createEx( MenuItem, "Open SQL Statement", StatementREPM, 0, -503, 0, 0, 0, 0 ) global constant ResultsLVPM = createEx( Popup, "ResultsLVPM", Main, 0, -600, 0, 0, 0, 0) global constant SelectColumnPI = createEx( MenuItem, "Shift To Column", ResultsLVPM, 0, -601, 0, 0, 0, 0 ) global constant SelectAllPI = createEx( MenuItem, "Select All Rows", ResultsLVPM, 0, -602, 0, 0, 0, 0 ) global constant CopyToClipPI = createEx(MenuItem, "Copy data to clipboard", ResultsLVPM, 0, -603, 0, 0, 0, 0 ) global constant ViewLOBDataPI = createEx(MenuItem, "View LOB Data", ResultsLVPM, 0, -604, 0, 0, 0, 0 ) global constant IFSREPM = createEx( Popup, "File Preview Popup Menu", Main, 0, 19, 0, 0, 0, 0 ) global constant UndoPI = createEx( MenuItem, "Undo", IFSREPM, 0, 0, 0, 0, 0, 0 ) setEnable( UndoPI, w32False ) global constant CopyPI = createEx( MenuItem, "Copy", IFSREPM, 0, 0, 0, 0, 0, 0 ) setEnable( CopyPI, w32False ) global constant CutPI = createEx( MenuItem, "Cut", IFSREPM, 0, 0, 0, 0, 0, 0 ) setEnable( CutPI, w32False ) global constant PastePI = createEx( MenuItem, "Paste", IFSREPM, 0, 0, 0, 0, 0, 0 ) setEnable( PastePI, w32False ) global constant RESelectAllPI = createEx( MenuItem, "Select All", IFSREPM, 0, 0, 0, 0, 0, 0 ) setEnable( RESelectAllPI, w32False ) -- Create a geometry manager for the main window global constant MainGMID = xControl( Geometry, "", Main, 0, 0, 0, 0, 0, 0) -- Create the left portion of the main window global constant mainLeft = create(Window, "", Main, 0, 0, 0, 0, {WS_CHILD,WS_VISIBLE,WS_CLIPSIBLINGS} ) global constant MainTV = createEx( TreeView, "", mainLeft, 0, 0, 0, 0, or_all({TVS_HASLINES,TVS_LINESATROOT,TVS_HASBUTTONS,TVS_SHOWSELALWAYS,TVS_INFOTIP}), 0 ) removeStyle(MainTV, WS_BORDER) -- Split the left/right sides of the main window global constant mainSplit = xControl( VSplitter, "", Main, 200, 0, 0, 0, 0, MainGMID ) -- Create the right portion of the main window global constant mainRightTC = create(TabControl, "", Main, 0, 0, 0, 0, 0 ) -- Create the DB2 tab item on the right global constant DB2TI = create(TabItem, "DB2", mainRightTC, 0, 0, 0, 0, 0 ) -- Create a geometry control for the tab control global constant mainRightTCGMID = xControl( Geometry, "", mainRightTC, 0, 0, 0, 0, 0, 0 ) -- Now create three sub windows of the DB2 tab item. Start with the top window and details list view global constant DB2Top = create(Window, "", DB2TI, 0, 0, 0, 0, {WS_CHILD,WS_VISIBLE,WS_CLIPSIBLINGS} ) -- Split the DB2 tab item in two global constant DB2Split = xControl( HSplitter, "", DB2TI, 0, 200, 0, 0, 0, mainRightTCGMID ) -- Create the bottom window of the DB2 tab item global constant DB2Bottom = create(Window, "", DB2TI, 0, 0, 0, 0, {WS_CHILD,WS_VISIBLE,WS_CLIPSIBLINGS} ) -- Create the two sub windows of the DB2 top section global constant DB2Details = create(Window, "", DB2Top, 0, 0, 0, 0, {WS_CHILD,WS_VISIBLE,WS_CLIPSIBLINGS} ) global constant MainLV = createEx( ListView, {}, DB2Details, 0, 0, 0, 0, or_all({LVS_REPORT,LVS_SHOWSELALWAYS}), 0 ) removeStyle(MainLV, WS_BORDER) -- Create a geometry control for the bottom of the DB2 tab item global constant DB2TopGMID = xControl( Geometry, "", DB2Top, 0, 0, 0, 0, 0, 0 ) -- Split the top of the DB2 tab item global constant DB2TopSplit = xControl( HSplitter, "", DB2Top, 0, 100, 0, 0, 0, DB2TopGMID ) -- Create the SQL window including the statement history and sql statement window global constant DB2SQLStmt = create(Window, "", DB2Top, 0, 0, 0, 0, {WS_CHILD,WS_VISIBLE,WS_CLIPSIBLINGS} ) global constant HistoryDDL = createEx( DropDownList, "", DB2SQLStmt, 0, 0, 0, 0, 0, 0 ) removeStyle(HistoryDDL, WS_BORDER) global constant StatementRE = createEx( RichEdit, "", DB2SQLStmt, 0, 0, 0, 0, or_all({ES_NOHIDESEL}), 0 ) removeStyle(StatementRE, WS_BORDER) -- Create the results list view global constant ResultsLV = createEx( ListView, {}, DB2Bottom, 0, 0, 0, 0, or_all({LVS_REPORT,LVS_SHOWSELALWAYS}), 0 ) removeStyle(ResultsLV, WS_BORDER) -- Create the IFS tab item global constant IFSTI = create(TabItem, "IFS", mainRightTC, 0, 0, 0, 0, 0 ) -- Create the IFS file edit window global constant DispEditLT = createEx( LText, "Displaying:", IFSTI, 0, 0, 0, 0, 0, 0 ) global constant IFSFileLT = createEx( LText, "", IFSTI, 0, 0, 0, 0, 0, 0 ) global constant IFSRE = createEx( RichEdit, "", IFSTI, 0, 0, 0, 0, w32or_all({ES_NOHIDESEL,ES_AUTOHSCROLL,WS_HSCROLL}), 0) -- Set a large buffer maximum for the IFS file edit control integer IDEok IDEok=sendMessage( IFSRE,197,9999999,0) -- Set some extended styles for the list views in the main window atom lvMask integer lvOk lvMask = or_all({LVS_EX_ONECLICKACTIVATE}) lvOk = sendMessage(MainLV,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask) lvMask = or_all({LVS_EX_FULLROWSELECT}) lvOk = sendMessage(MainLV,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask) lvMask = or_all({LVS_EX_HEADERDRAGDROP}) lvOk = sendMessage(MainLV,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask) lvMask = or_all({LVS_EX_GRIDLINES}) lvOk = sendMessage(MainLV,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask) lvMask = or_all({LVS_EX_ONECLICKACTIVATE}) lvOk = sendMessage(ResultsLV,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask) lvMask = or_all({LVS_EX_FULLROWSELECT}) lvOk = sendMessage(ResultsLV,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask) lvMask = or_all({LVS_EX_HEADERDRAGDROP}) lvOk = sendMessage(ResultsLV,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask) lvMask = or_all({LVS_EX_GRIDLINES}) lvOk = sendMessage(ResultsLV,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask) -- Create buttons in the toolbar global constant OpenPB = createEx( PictureButton, "", MainTB, 0, 0, 30, 30, 0, 0 ) setHint( OpenPB,"Open a specific file") global constant SavePB = createEx( PictureButton, "", MainTB, 30, 0, 30, 30, 0, 0 ) setHint( SavePB,"Save the results of the SQL statement") global constant ExecutePB = createEx( PictureButton, "", MainTB, 60, 0, 30, 30, 0, 0 ) setHint( ExecutePB,"Run the SQL statement") global constant ClearHistPB = createEx( PictureButton, "", MainTB, 90, 0, 30, 30, 0, 0 ) setHint( ClearHistPB,"Clear the SQL history log") global constant RefreshPB = createEx( PictureButton, "", MainTB, 120, 0, 30, 30, 0, 0 ) setHint( RefreshPB,"Refresh selected entry") global constant ExitPB = createEx( PictureButton, "", MainTB, 154, 0, 30, 30, 0, 0 ) setHint( ExitPB,"Exit the program") -- Now we'll work on managing the size/placement of the controls on the main window global constant MainLS = xControl( LimitSize, "", Main, 400, 400, 0, 0, 0, 0 ), mainLeftGMID = xControl( Geometry, "", mainLeft, 0, 0, 0, 0, 0, 0 ), DB2BottomGMID = xControl( Geometry, "", DB2Bottom, 0, 0, 0, 0, 0, 0 ), DB2DetailsGMID = xControl( Geometry, "", DB2Details, 0, 0, 0, 0, 0, 0 ), DB2SQLStmtGMID = xControl( Geometry, "", DB2SQLStmt, 0, 0, 0, 0, 0, 0 ) manage(MainGMID, MainTB, {0, 0}, {0, 0}, {1, 0}, {0, 34}) manage(MainGMID, mainLeft, {0,5}, {0,5}, {mainSplit,0}, {1.0,0}) manage(MainGMID, mainRightTC, {mainSplit,0}, {0,5}, {1.0,-5}, {1.0,-15}) manage(mainLeftGMID, MainTV, {0, 0}, {0, 0}, {1.0,0}, {1.0,-5} ) manage(mainRightTCGMID, DB2Top, {0,0}, {0,0}, {1,-5}, {DB2Split,0}) manage(mainRightTCGMID, DB2Bottom, {0,0}, {DB2Split,0}, {1,-5}, {1,0}) manage(DB2TopGMID, DB2Details, {0,0}, {0,0}, {1.0,0}, {DB2TopSplit,0}) manage(DB2TopGMID, DB2SQLStmt, {0,0}, {DB2TopSplit,0}, {1.0,0}, {1.0,0}) manage(DB2DetailsGMID, MainLV, {0,0}, {0, 0}, {1, -5}, {1.0, 0}) manage(DB2SQLStmtGMID, HistoryDDL, {0, 0}, {0, 0}, {1, 0}, {HistoryDDL, 120}) manage(DB2SQLStmtGMID, StatementRE, {0, 0}, {0, 25}, {1, 0}, {1, 0}) manage(DB2BottomGMID, ResultsLV, {0, 0}, {0, 0}, {1, 0}, {1.0, -5}) manage(mainRightTCGMID, DispEditLT, {0,5}, {0,5}, {DispEditLT,104},{DispEditLT,24}) manage(mainRightTCGMID, IFSFileLT, {DispEditLT,5}, {0,5}, {1,-5},{IFSFileLT,24}) manage(mainRightTCGMID, IFSRE, {0,0}, {DispEditLT,5}, {1,0}, {1,-5}) WinMain( Main, Maximized )
Jonas Temple http://www.yhti.net/~jktemple