program stimgt,1.0(104) ! test image in a static control (in a TAB) !------------------------------------------------------------------------ !{Edit History} ! 19-11-2007 --- 104 --- Jack McGregor ! Add 2 new panes to show vertical or horiz centering independently ! Adjust 5th/6th image sizes to be more square-like ! ! 18-11-2007 --- 103 --- Jack McGregor ! Add winstyle param to image procedure; use it to test alternate ! method of centering images using SS_CENTERIMAGE ! ! 17-11-2007 --- 102 --- Jack McGregor ! Variation of stimg which displays several images in a TAB control ! ! 15-11-2007 --- 101 --- Jack McGregor ! Fix problem of image overlapping bottom of groupbox by switching to millirows. ! ++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 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 define IMGFILE$ = "sandal.jpg" ! image to display ? tab(-1,0);! "Images using AUI_CONTROL, MBF_STATIC+MBF_BITMAP+MBF_NODISTORT (TAB version)" 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 ! define the information for the tab panes ctype = MBF_STATIC + MBF_BITMAP ! this is common to all pane'ctype(1) = ctype pane'title$(1) = "MBF_STATIC + MBF_BITMAP (Stretched)" pane'label$(1) = "Stretch" pane'winstyle(1) = WS_THICKFRAME ! [103] pane'ctype(2) = ctype + MBF_NODISTORT pane'title$(2) = "MBF_STATIC + MBF_BITMAP + MBF_NODISTORT" pane'label$(2) = "No Distort (top left)" 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,22,72, NUL_FGC,NUL_BGC,NUL_FONTATTR,NUL_FONTSCALE, & NUL_FONTFACE$, NUL_TOOLTIP$, NUL_PARENTID, & NUL_WINCLASS$, TCS_MULTILINE ! [104] ! create an exit button xcall AUI, AUI_CONTROL, CTLOP_ADD, "exitbtn", "Exit", MBST_ENABLE, & MBF_BUTTON+MBF_KBD, "VK_ESC", NUL_FUNC$, NUL_CSTATUS, 23,35,24,45 ? 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 ! 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 ! display the images ctype = pane'ctype(tabno) call do'static'image(1500, 2,13000,25, pane'ctype(tabno), IMGFILE$, tabid$, pane'winstyle(tabno)) call do'static'image(1500, 28, 5000,39, pane'ctype(tabno), IMGFILE$, tabid$, pane'winstyle(tabno)) call do'static'image(13500, 2,17000,25, pane'ctype(tabno), IMGFILE$, tabid$, pane'winstyle(tabno)) call do'static'image(5500, 28,17000,39, pane'ctype(tabno), IMGFILE$, tabid$, pane'winstyle(tabno)) call do'static'image(1500, 42,10500,63, pane'ctype(tabno), IMGFILE$, tabid$, pane'winstyle(tabno)) call do'static'image(11000,42,17000,63, pane'ctype(tabno), IMGFILE$, tabid$, pane'winstyle(tabno)) End Procedure !-------------------------------------------------------------------------- ! Procedure to display a single image ! Params: ! srow,scol,erow,ecol [num, in] - coordinates ! ctype [b4, in] - flags ! imgfile$ [string, in] - image filespec ! parentid$ [string,in] - id of parent control ! winstyle [b4, in] - winstyle flags !-------------------------------------------------------------------------- Procedure do'static'image(srow as b2, scol as b2, erow as b2, ecol as b2, & ctype as b4, imgfile$ as s80, parentid$ as s24, & winstyle as b4) xcall AUI, AUI_CONTROL, CTLOP_ADD, NUL_CTLID, imgfile$, MBST_ENABLE, & ctype, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, & srow,scol,erow,ecol,NUL_FGC,NUL_BGC,NUL_FONTATTR,NUL_FONTSCALE, & NUL_FONTFACE$, NUL_TOOLTIP$, parentid$, & NUL_WINCLASS$, winstyle ! [103] End Procedure