program staticwin,1.0(101) ! experiment with different control styles for FMC !------------------------------------------------------------------------- !{Edit History} ! ! 10-22-2009 --- 102 --- Jack McGregor ! Fix confusion between MBF2_STATICWIN and ctype and ctype2. (It belongs ! in ctype2, but A-Shell prior to 1163.3 had the same problem.) ! ! 10-13-2009 --- 101 --- Jack McGregor ! Use new MBF2_STATICWIN in place of "MIAMECTL"; add 2nd tab panel to ! test more variations ! ! 10-08-2009 --- 100 --- Jack McGregor ! Created ! ++include ashinc:ashell.def ! (these symbols are in the latest ashell.def, but can be defined redundantly) define WS_THICKFRAME = &h040000 ! creates a raised panel effect define SS_CENTERIMAGE = &h0200 ! use with MBF_STATIC images to center in all ways define MBF_VCENTER = &h0020 ! define MBF_HCENTER = &h00C0 ! MBF_RTJUST + MBF_LFJUST define MBF_CENTER = &h00E0 ! MBF_HCENTER + MBF_VCENTER define MBF2_STATICWIN = &h00004000 define WS_EX_STATICEDGE = &h00020000 define WS_EX_WINDOWEDGE = &h00000100 map1 parentid$,s,10 map1 ctype,b,4 map1 tabdefs$,s,200 map1 tabpane,b,1 ! tab pane # map1 exitcode,f map1 paneinfo(6) map2 pane'ctype,b,4 ! flags for images in this pane map2 pane'title$,s,80 ! description map2 pane'label$,s,30 ! msg to display on the tab label map2 pane'winstyle,b,4 ! [103] winstyle flags ? tab(-1,0);! "Alternate control styles" input "Use Dialog? [y/N] ",parentid$ ! if parentid$ = "" parentid$ = "N" ! if ucs(parentid$) = "Y" then ! parentid$ = "dlg1" ! else ! parentid$ = "" ! endif ! if parentid$ # "" then ! xcall AUI, AUI_CONTROL, CTLOP_ADD, parentid$, & "Test Images using AUI_CONTROL, MBF_STATIC+MBF_BITMAP (with Tab)", MBST_ENABLE, & MBF_DIALOG+MBF_SYSMENU+MBF_MAXBUTTON+MBF_ALTPOS, NUL_CMD$, NUL_FUNC$, & NUL_CSTATUS, 1000,1,25000,80,NUL_FGC,NUL_BGC, & NUL_FONTATTR,NUL_FONTSCALE, NUL_FONTFACE$, "Dialog tool tip", & NUL_PARENTID, NUL_WINCLASS$, NUL_WINSTYLE, NUL_WINSTYLEX, MBF2_RESIZE else xcall AUI, AUI_CONTROL, CTLOP_ADD, NUL_CTLID, & "Test Images using AUI_CONTROL, MBF_STATIC+MBF_BITMAP (with Tab)", MBST_ENABLE, & MBF_STATIC+MBF_CENTER, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 1000,1,2200,80,NUL_FGC,NUL_BGC,FA_HEAVY,120,NUL_FONTFACE$, & "Static tool tip", parentid$ ! [105] endif ! define the information for the tab panes ctype = MBF_STATIC + MBF_BITMAP ! this is common to all pane'ctype(1) = ctype pane'label$(1) = "MBF2_STATICWIN" ! pane'winstyle(1) = WS_THICKFRAME ! [103] pane'ctype(2) = ctype pane'label$(2) = "MBF_STATIC + MBF_FRAME" ! pane'winstyle(2) = WS_THICKFRAME ! [103] pane'ctype(3) = ctype + MBF_NODISTORT + MBF_HCENTER pane'title$(3) = "MBF_STATIC + MBF_BITMAP + MBF_NODISTORT + MBF_HCENTER (H Centered)" pane'label$(3) = "No Distort (top center)" pane'winstyle(3) = WS_THICKFRAME ! [103] pane'ctype(4) = ctype + MBF_NODISTORT + MBF_VCENTER pane'title$(4) = "MBF_STATIC + MBF_BITMAP + MBF_NODISTORT + MBF_VCENTER (V Centered)" pane'label$(4) = "No Distort (left Vcenter)" pane'winstyle(4) = WS_THICKFRAME ! [103] pane'ctype(5) = ctype + MBF_NODISTORT + MBF_CENTER ! [104] pane'title$(5) = "MBF_STATIC + MBF_BITMAP + MBF_NODISTORT + MBF_CENTER (H/V Centered)" pane'label$(5) = "No Distort (H/V Center)" pane'winstyle(5) = WS_THICKFRAME ! [103] pane'ctype(6) = ctype + MBF_NODISTORT pane'title$(6) = "MBF_STATIC + MBF_BITMAP + MBF_NODISTORT; WINSTYLE=SS_CENTERIMAGE" pane'label$(6) = "SS_CENTERIMAGE" pane'winstyle(6) = WS_THICKFRAME + SS_CENTERIMAGE ! [103] ! create a Tab control tabdefs$ = pane'label$(1) + "~VK_xF101~~" & + pane'label$(2) + "~VK_xF102~~" ! + pane'label$(3) + "~VK_xF103~~" & ! + pane'label$(4) + "~VK_xF104~~" & ! + pane'label$(5) + "~VK_xF105~~" & ! + pane'label$(6) + "~VK_xF106" xcall AUI, AUI_CONTROL, CTLOP_ADD, "tabctl", tabdefs$, MBST_ENABLE, & MBF_TAB, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 4,8,14,72, NUL_FGC,&hDDEEFF,NUL_FONTATTR,NUL_FONTSCALE, & NUL_FONTFACE$, "Tab tool tip", parentid$, & NUL_WINCLASS$, TCS_MULTILINE ! [104][105] ! create an exit button xcall AUI, AUI_CONTROL, CTLOP_ADD, "exitbtn", "Exit", MBST_ENABLE, & MBF_BUTTON+MBF_KBD, "VK_ESC", NUL_FUNC$, NUL_CSTATUS, 15,35,16,45, & NUL_FGC, NUL_BGC, NUL_FONTATTR, NUL_FONTSCALE, NUL_FONTFACE$, & "Exit program", parentid$ ! [105] ? tab(-1,29); ! turn cursor off (looks better) tabpane = 1 ! set tab pane #1 do call do'pane(tabpane, "tabctl") ! (one routine handles all panes) ! wait for an event xcall AUI, AUI_EVENTWAIT, 0, 0, exitcode, EVW_NOFOCUS+EVW_DESCEND if exitcode < -100 then tabpane = abs(exitcode)-100 loop until exitcode = 1 ? tab(-1,0); ! (easy way to release all the resources) ? tab(-1,28); ! turn cursor back on End !-------------------------------------------------------------------------- ! Procedure to display an image in several sizes on the specified pane ! Params: ! tabpane [numeric, in] - indicates the pane # (used as idx to paneinfo) ! tabid$ [string, in] - id/name of tab control ! Globals: ! paneinfo() !-------------------------------------------------------------------------- Procedure do'pane(tabno as b1, tabid$ as s24) ++pragma AUTO_EXTERN map1 BGCPINK,B,4,&hAACCFF map1 BGCBLUE,B,4,&hFFCCAA ! clear the tab display area xcall AUI, AUI_CONTROL, CTLOP_CLR, tabid$ ! select the new pane # xcall AUI, AUI_CONTROL, CTLOP_PANE, tabid$, NUL_CTEXT$, tabno ! display an explanatory message above the tab control ! xcall AUI, AUI_CONTROL, CTLOP_ADD, NUL_CTLID, pane'title$(tabno), MBST_ENABLE, & ! MBF_STATIC, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & ! 2500,5,3900,75,NUL_FGC,NUL_BGC,FS_ITALIC,150 if tabno = 1 then ! MBF2_STATICWIN variations !-------------------------------------------------------------------------------- ! alternative #1 - MBF2_STATICWIN !-------------------------------------------------------------------------------- !This would work except that we get the title twice - once in caption, once in body ! xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb1a", "Title 1", MBST_ENABLE, & ! MBF_STATIC+MBF_FRAME, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & ! 2,3,8,20, NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & ! "Pseudo-groupbox style 1", tabid$, NUL_WINCLASS$, WS_CAPTION, NUL_WINSTYLEX !Alternative - requires 1162.0 to define MBF2_STATICWIN xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb1a", "Title 1", MBST_ENABLE, & 0, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 2,3,8,16, NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "MBF2_STATICWIN with WS_CAPTION+WS_BORDER", tabid$, NUL_WINCLASS$, & WS_CAPTION or WS_BORDER, NUL_WINSTYLEX, MBF2_STATICWIN ! [102] ! Sample field xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb1atext1", & "This version uses MBF2_STATICWIN, with WS_CAPTION + WS_BORDER", MBST_ENABLE, & MBF_STATIC+MBF_LFJUST, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 2,3,6,13,NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "Text tool tip", "gb1a", NUL_WINCLASS$, NUL_WINSTYLE, NUL_WINSTYLEX !Same as above but with toolwindow xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb1b", "Title 1", MBST_ENABLE, & 0, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 2,18,8,31, NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "MBF2_STATICWIN with WS_CAPTION+WS_BORDER+WS_EX_TOOLWINDOW", tabid$, NUL_WINCLASS$, & WS_CAPTION or WS_BORDER, WS_EX_TOOLWINDOW, MBF2_STATICWIN ! [102] ! Sample field xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb1btext1", & "This version uses MBF2_STATICWIN, with WS_CAPTION, WS_BORDER, WS_EX_TOOLWINDOW", MBST_ENABLE, & MBF_STATIC+MBF_LFJUST, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 2,3,6,13,NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "Text tool tip", "gb1b", NUL_WINCLASS$, NUL_WINSTYLE, NUL_WINSTYLEX !Same as above but without border xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb1c", NUL_CTEXT$, MBST_ENABLE, & 0, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 2,33,8,46, NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "MBF2_STATICWIN, no caption ", tabid$, NUL_WINCLASS$, & WS_BORDER, NUL_WINSTYLEX, MBF2_STATICWIN ! [102] ! Sample field xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb1ctext1", & "This version uses MBF2_STATICWIN, no caption", MBST_ENABLE, & MBF_STATIC+MBF_LFJUST, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 3,3,6,14,NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "Text tool tip", "gb1c", NUL_WINCLASS$, NUL_WINSTYLE, NUL_WINSTYLEX !Same as above but with manually created title xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb1d", NUL_CTEXT$, MBST_ENABLE, & 0, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 2,48,8,61, NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "MBF2_STATICWIN, WS_BORDER, title overlay", tabid$, NUL_WINCLASS$, & WS_BORDER, NUL_WINSTYLEX, MBF2_STATICWIN ! [102] xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb1dcaption", " Title 1", MBST_ENABLE, & MBF_STATIC+MBF_LFJUST+MBF_VCENTER, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 1000,1,2000,14, NUL_FGC,BGCBLUE, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "MBF2_STATICWIN, WS_BORDER, title overlay", "gb1d", NUL_WINCLASS$, & NUL_WINSTYLE, WS_EX_STATICEDGE ! Sample field xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb1dtext1", & "This version uses MBF2_STATICWIN with MBF_STATIC + WS_EX_STATICEDGE title overlay", MBST_ENABLE, & MBF_STATIC+MBF_LFJUST, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 3,3,6,13,NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "Text tool tip", "gb1d", NUL_WINCLASS$, NUL_WINSTYLE, NUL_WINSTYLEX elseif tabno = 2 then ! MBF_STATIC+MBF_FRAME variations !-------------------------------------------------------------------------------- ! alternative #2 - static panel with separate title control !-------------------------------------------------------------------------------- xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb2", NUL_CTEXT$, MBST_ENABLE, & MBF_STATIC+MBF_FRAME, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 2,24,8,41,NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "Pseudo-groupbox style 2", tabid$, NUL_WINCLASS$, NUL_WINSTYLE, NUL_WINSTYLEX ! simulate title bar by putting a static control across it xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb2title", "Title2", MBST_ENABLE, & MBF_STATIC+MBF_FRAME+MBF_VCENTER+MBF_LFJUST, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 1000,1,2200,18,NUL_FGC,BGCBLUE, FA_HEAVY,NUL_FONTSCALE,NUL_FONTFACE$, & "Pseudo Title bar", "gb2", NUL_WINCLASS$, NUL_WINSTYLE, NUL_WINSTYLEX ! Sample field xcall AUI, AUI_CONTROL, CTLOP_ADD, "gb2text1", & "This version uses MBF_STATIC + MBF_FRAME and simulates the caption with a separate static control", & MBST_ENABLE, & MBF_STATIC+MBF_LFJUST, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & 3,4,6,17,NUL_FGC,BGCPINK, NUL_FONTATTR,NUL_FONTSCALE,NUL_FONTFACE$, & "Text tool tip", "gb2", NUL_WINCLASS$, NUL_WINSTYLE, NUL_WINSTYLEX endif End Procedure