[Wnd-commit] wnd/wnd_doc/doc/controls/control classes/trackbar .CVSIGNORE,NONE,1.1 trackbar.dtpl,NON
Status: Alpha
Brought to you by:
jurner
|
From: jürgen u. <cer...@us...> - 2005-07-23 19:58:50
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/controls/control classes/trackbar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4369 Added Files: .CVSIGNORE trackbar.dtpl Log Message: bit of this and a bit of that --- NEW FILE: .CVSIGNORE --- *.html *.gif --- NEW FILE: trackbar.dtpl --- ::defaultpage:: Trackbar ::site:: Trackbar <IMG SRC="Trackbar.gif"></IMG> <br><br> <a HREF="contents.html">Trackbar contents</a> <br><br> ::site:: class TrackbarFromHandle <code class=import>defined in: wnd.controls.trackbar</code><br><br> <code>TrackbarFromHandle(hwnd, *styles)</code><br> <P> Wraps Trackbar methods around a hwnd. <br><br> Styles can be 'debug' or 'debugall'. </P> ::site:: class Trackbar <code class=import>defined in: wnd.controls.trackbar</code><br><br> <code>Trackbar(parent, x, y, w, h, *styles)</code><br> ::site:: Trackbar messages A Trackbar control sends the following messages to the message handler:<br><br> <DL> <DT>'customdraw' <DD><br> wp=allways zero<br> lp=a NMCUSTOMDRAW staructure<br> See <a HREF="customdrawing Trackbars.html">customdrawing Trackbars</a> <br><br> <DT>'releasedcapture' <DD><br> wp=allways zero<br> lp=allways zero<br> The Trackbar control released the mouse capture <br><br> </DL> ::site:: customdrawing Trackbars Everytime a Trackbar needs to be redrawn a 'customdraw' message is send with the lParam set to a NMCUSTOMDRAW structure: <br><br> Structure NMCUSTOMDRAW<br> <P> <strong>Members:</strong><br> <DL> <DT>NMHDR <DD>the notification header <DT>drawStage <DD>the current draw stage <DT>hdc <DD>handle of the device context to draw to <DT>rc <DD>the rectangle of the item This rect seems to be invalid (at least in comctl32 ver5.81 the bottom portion points to somewhere next the northpole, so do not use). <DT>itemSpec <DD>contains additional information about what is about to be painted </DL> <br><br> Depending on the drawStage only certain members will contain valid information. <br><br> The structure carrys along the following constants: <P> <TABLE class="table1" BORDER="1"> <TH colspan="2">drawStage flags</TH> <TR> <TD>PREPAINT</TD> <TD>indicates the start of the painting cycle</TD> </TR> <TR> <TD>POSTPAINT</TD> <TD>the painting cycle is completed. You may apply additional painting here</TD> </TR> </TABLE> <TABLE class="table1" BORDER="1"> <TH colspan="2">return values</TH> <TR> <TD>DODEFAULT</TD> <TD>tells the trackbar to do all default painting</TD> </TR> <TR> <TD>NEWFONT</TD> <TD>tells the trackbar that a new font was selected into the device context</TD> </TR> <TR> <TD>SKIPDEFAULT</TD> <TD>tells the trackbar not to do any default drawing</TD> </TR> <TR> <TD>NOTIFYITEMDRAW</TD> <TD>tells the trackbar to to notify you about item drawing</TD> </TR> <TR> <TD>NOTIFYPOSTPAINT</TD> <TD>tells the trackbar to to notify you about item drawing after the item has been painted</TD> </TR> </TABLE> <br><br> The itemSpec member may contain one of the following flags: <TABLE class="table1" BORDER="1"> <TR> <TD>CHANNEL</TD> <TD>identifies the chanel the thumbmarker slides along</TD> </TR> <TR> <TD>THUMB</TD> <TD>identifies the thumb marker</TD> </TR> <TR> <TD>TICS</TD> <TD>identifyes the tickmarks</TD> </TR> </TABLE> <br><br> Custom draw sample code. Draw a simple blue slider instead of the default one: <pre> from wnd import gdi from wnd.wintypes import RGB def on_trackbar(self, hwnd, msg, wp, lp): if msg=="customdraw": if lp.drawStage==lp.PREPAINT: \# tell the trackbar to send notifications about item drawing return lp.NOTIFYITEMDRAW else: if lp.itemSpec== lp.THUMB: \# the thumb is about to be drawn dc= gdi.DCFromHandle(lp.hdc) brush= gdi.SolidBrush(RGB(0, 0, 255)) brush.FillRect(dc, lp.rc) brush.Close() dc.Close() \# tell the trackbar not to overwrite our changes return lp.SKIPDEFAULT </pre> ::site:: Trackbar styles The following styles are used with Trackbar controls:<br><br> <TABLE class="table1" BORDER="1"> <TR> <TD>'autoticks'</TD> <TD>enables using of the <a HREF="trackbar methods/SetTickStep.html">SetTickStep</a> method. </TD> </TR> <TR> <TD>'both'</TD> <TD>the control will display tick-marks on both sides</TD> </TR> <TR> <TD>'bottom'</TD> <TD>'horz' trackbars will display tick-marks on the bottom side only</TD> </TR> <TR> <TD>'enableselrange'</TD> <TD>The trackbar control can display a selection range only. The tick marks at the starting and ending positions of a selection range are displayed as triangles (instead of vertical dashes), and the selection range is highlighted <br> Sorry, never seen any hilight here </TD> </TR> <TR> <TD>'fixedlength'</TD> <TD>enables changing the sliders size</TD> </TR> <TR> <TD>'horz'</TD> <TD>creates a horizontally oriented Trackbar</TD> </TR> <TR> <TD>'left'</TD> <TD>'vert' trackbars will display tick-marks on the left side only</TD> </TR> <TR> <TD>'nothumb'</TD> <TD>the Trackbar does not show a slider</TD> </TR> <TR> <TD>'noticks'</TD> <TD>the trackbar does not show any ticks</TD> </TR> <TR> <TD>'right'</TD> <TD>'vert' trackbars will display tick-marks on the right side only</TD> </TR> <TR> <TD>'top'</TD> <TD>'horz' trackbars will display tick-marks on the top side only</TD> </TR> <TR> <TD>'vert'</TD> <TD>creates a vertically oriented Trackbar</TD> </TR> </TABLE> ::folder:: Trackbar methods Trackbar controls support the following methods: <a HREF="||method-ctrl||">Common methods</a> ::item:: ClearSelected <code>ClearSelection()</code><br> <P>Clears the current selection of the Trackbar <br><br> Only 'enableselrange' Trackbars can have a selection </P> ::item:: Clear <code>Clear()</code><br> <P>Clears the ticks of the Trackbar except the first and the last, wich are created automatically. </P> ::item:: GetLeftBuddy <code>GetLeftBuddy()</code><br> <P>Returns the hwnd of the left buddy window for a 'vert' Trackbar , the top buddy window hwnd for a 'horz' Trackbar or None </P> ::item:: GetTopBuddy <code>GetTopBuddy()</code><br> <P>Returns the hwnd of the left buddy window for a 'vert' Trackbar , the top buddy window hwnd for a 'horz' Trackbar or None </P> ::item:: GetRightBuddy <code>GetRightBuddy()</code><br> <P>Returns the hwnd of the right buddy window for a 'horz' Trackbar , the bottom buddy window hwnd for a 'vert' Trackbar or None </P> ::item:: GetBottomBuddy <code>GetBottomBuddy()</code><br> <P>Returns the hwnd of the right buddy window for a 'vert' Trackbar , the bottom buddy window hwnd for a 'vert' Trackbar or None </P> ::item:: GetChannelRect <code>GetChannelRect()</code><br> <P>Returns a ||type-RECT|| containing the oordinates of the channel rect of the Trackbar <br><br> The channel is the thinggy the slider slides in </P> ::item:: GetLineSize <code>GetLineSize()</code><br> <P>Returs the number of pixels the slider moves in response to pressing an arrow key. </P> ::item:: GetTicks <code>GetTicks()</code><br> <P>Returns the number of tick-marks the Trackbar currently has. </P> ::item:: GetPageSize <code>GetPageSize()</code><br> <P>Returns the number of pixels the slider moves in response to pressing pageup oe pagedown keys. </P> ::item:: GetPos <code>GetPos()</code><br> <P>Returns the current logical position of the slider </P> ::item:: GetTickList <code>GetTickList</code><br> <P>Returns a list containing the current positions of the tick-marks on the Trackbar, not including the first and the last. </P> ::item:: GetRange <code>SetRange(nMin, nMax)</code><br> <P>Returns a <b>tuple(nMin, nMax)</b> containing the minimum and maximum ranges for the Trackbar </P> ::item:: GetSelected <code>GetSelected()</code><br> <P>Returns a <b>tuple(nStart, nEnd)</b> containing lower and upper tick-mark index of the current selected range <br><br> Only 'enableselrange' Trackbars can have a selection </P> ::item:: GetThumbSize <code>GetThumbSize</code><br> <P>Returns the size of the slider (in pixels) </P> ::item:: GetThumbRect <code></code><br> <P>Returns a ||type-RECT|| containing the coordinates of ther slider </P> ::item:: GetTick <code>GetTick(i)</code><br> <P>Returns the logical position of the specified tick </P> ::item:: GetTickPos <code>GetTickPos(i)</code><br> <P>Returns the physical position (in pixels) of the specified tick </P> ::item:: GetTooltips <code>GetTooltips()</code><br> <P>Returns the hwnd of the associated Tooltip control or None </P> ::item:: SetLeftBuddy <code>SetLeftBuddy(Control)</code><br> <P>Associates a left buddy control to a 'horz' Trackbar or a top buddy control to a 'vert' Trackbar. <br><br> Return value<br> The hwnd of the buddy control formerly assigned to the Trackbar or None </P> ::item:: SetTopBuddy <code>SetLeftBuddy(Control)</code><br> <P>Associates a left buddy control to a 'horz' Trackbar or a top buddy control to a 'vert' Trackbar. <br><br> Return value<br> The hwnd of the buddy control formerly assigned to the Trackbar or None </P> ::item:: SetRightBuddy <code>SetLeftBuddy(Control)</code><br> <P>Associates a right buddy control to a 'horz' Trackbar or a bottom buddy control to a 'vert' Trackbar. <br><br> Return value<br> The hwnd of the buddy control formerly assigned to the Trackbar or None </P> ::item:: SetBottomBuddy <code>SetLeftBuddy(Control)</code><br> <P>Associates a right buddy control to a 'horz' Trackbar or a bottom buddy control to a 'vert' Trackbar. <br><br> Return value<br> The hwnd of the buddy control formerly assigned to the Trackbar or None </P> ::item:: SetLineSize <code>SetLineSize(n)</code><br> <P>Sets the amount (in pixels) the slider moves when an arrow key is pressed <br><br> Return value<br> The previous line size </P> ::item:: SetPageSize <code>SetPageSize(n)</code><br> <P>Sets the amount (in pixels) the slider moves when pageup or pagedown key is pressed <br><br> Return value<br> The previous page size </P> ::item:: SetPos <code>SetPos(i)</code><br> <P>Sets the current logical position of the slider. <br><br> <pre> trackbar.SetPos(2) </pre> Moves the slider to the 1. tick on the Trackbar <br><br> Return value<br> The previous logical position </P> ::item:: SetRange <code>SetRange(self, nMin, nMax)</code><br> <P>Sets the current minimum and maximum range for the Trackbar <br><br> </P> ::item:: SetSelected <code>SetSelected(iMin, iMax)</code><br> <P>Sets the current selection for a Trackbar. <br><br> iMin and iMax should be the tick-marks to set the selection range to </P> ::item:: SetThumbSize <code>SetThumbSize(n)</code><br> <P>Sets the length of the slider (in pixels) <br><br> To make this method work the Trackbar must have the 'fixedlength' style set </P> ::item:: SetTick <code>SetTick(i)</code><br> <P>Sets a tick-mark on the Trackbar. <b>i</b> should be a value in the curent range of the Trackbar <br><br> </P> ::item:: SetTickStep <code>SetTickStep(i)</code><br> <P>Sets a bunch of tick-marks at-once. <br><br> To make this method work the Trackbar must have the 'autoticks' style set <pre> trackbar.SetTickStep(5) </pre> Will set a tick-mark each 5 units <br><br> <b>n</b> gives the step-size </P> ::item:: SetTooltipsLeft <code>SetTooltipsLeft()</code><br> <P>Sets the Tooltips displayed for a Trackbar to its left side <br><br> <br><br> Return value<br> The previous side tooltips where shown at, 'left', 'top', 'right' or 'bottom' </P> : ::item:: SetTooltipsTop <code>SetTooltipsTop()</code><br> <P>Sets the Tooltips displayed for a Trackbar to its top side <br><br> <br><br> Return value<br> The previous side tooltips where shown at, 'left', 'top', 'right' or 'bottom' </P> ::item:: SetTooltipsRight <code>SetTooltipsRight()</code><br> <P>Sets the Tooltips displayed for a Trackbar to its right side <br><br> <br><br> Return value<br> The previous side tooltips where shown at, 'left', 'top', 'right' or 'bottom' </P> ::item:: SetTooltipsBottom <code>SetTooltipsBottom()</code><br> <P>Sets the Tooltips displayed for a Trackbar to its bottom side <br><br> <br><br> Return value<br> The previous side tooltips where shown at, 'left', 'top', 'right' or 'bottom' </P> ::item:: SetTooltips <code>SetTooltips(Tooltip)</code><br> <P>Associates aTooltip control to the Trasckbar <br><br> </P> # ::item:: # <code></code><br> # <P> # <br><br> # </P> |