Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ Win32 Trying to create an owner drawn toggle button
    primarykey
    data
    text
    <p>I have been trying for a very long time (well a few days) to create a toggle button. A button having a up or down state.</p> <p>Took over a day to realize it is not possible to create an owner drawn toggle button, a checkbox and pushlike does not work. When using owner drawn there is no difference between a checkbox or regular button (MSDN also notes you cant use owner drawn with any of those styles.)</p> <p>From reading I found out you have to do it yourself, normally not a problem at all, but I cannot get any real "responsiveness." That is, if I click fast, nothing happens, sometimes I will click and it changes states, other times not and only updates when I click a different button.</p> <p>I created a global variable for if the button should be shown in up or down state. In the commands I have it set that when the button, IDC_BTN_TOGGLE, it will set the opposite value on the bool.</p> <p>Then the draw item part:</p> <pre><code>// button down if ((pDIS-&gt;itemState &amp; ODS_SELECTED) || showButtonDown) { oldBrush = (HBRUSH)SelectObject(pDIS-&gt;hDC, theme.hBrush[BRUSH_BUTTON2]); } // button up else { oldBrush = (HBRUSH)SelectObject(pDIS-&gt;hDC, theme.hBrush[BRUSH_BUTTON]); } </code></pre> <p>All my buttons are owner drawn and run through this. showButtonDown is only true when it is drawing IDC_BTN_TOGGLE and the top bool is true as well.</p> <p>The normal buttons function normally, when I click them, it instantly shows the down state, release, back to normal, the toggle button is barely responsive.</p> <p><img src="https://i.stack.imgur.com/bpsAR.png" alt="enter image description here"> </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload