Vertically align text in string gadget?

Just starting out? Need help? Post your questions and find answers here.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Vertically align text in string gadget?

Post by srod »

The following code in the WM_PAINT event of the parent control of a string gadget allows me to position the text within a string gadget:

Code: Select all

    case #WM_PAINT
    text$=getgadgettext(stringid)
    beginpaint_(hWnd, @lp.PAINTSTRUCT)
    selectobject_(lp\hdc, usefont(1))
    TextOut_(lp\hdc,lp\rcPaint\left+5, lp\rcPaint\top + 14, @text$, LEN(text$))
    endpaint_(hWnd, @lp)
    result = 0
However, as soon as I click within the string gadget to edit the text, the caret etc. appears back at the top left!

Anyone know how to set the equivalent of a 'top' margin in a single-line string gadget? Reckon I'm overlooking something simple!
I may look like a mule, but I'm not a complete ass.