PDA

View Full Version : WDL_VWnd questions


Jeffos
01-12-2011, 05:43 AM
I really like WDL_VWnd. I'm stuck with 2 questions (for the moment ;)), I have a feeling they're obvious things but I really can't figure them out. Help !

1) I'm facing a focus issue with WDL_VirtualComboBox :
EDIT2: Forget that, got it (here (http://code.google.com/p/sws-extension/source/browse/branches/beta/SnM/SnM_FXChainView.cpp#1084) if interested, obvious indeed!)

http://stash.reaper.fm/7544/WDL_VirtualIconButton.gif
edit: error in the anim's title, no pb with WDL_VirtualIconButton

As shown in the anim, since such a dropdown has been used, it's a bit like something steals the focus. Not harmfull of course, but it's really painfull from the user POV, he/she has to click *twice* every time he has used a dropdown (in the anim, click twice to activate another window).
I'm quiet sure it's a SetCapture()/ReleaseCapture() issue vs the popup. I can't see anything obvious in the WDL_VirtualComboBox code. On my side I have a "standard" mouse events implemention (well, I hope :)):

[...]
case WM_LBUTTONDOWN:
SetFocus(m_hwnd);
if (m_parentVwnd.OnMouseDown(GET_X_LPARAM(lParam),GET _Y_LPARAM(lParam)))
SetCapture(m_hwnd);
break;
case WM_LBUTTONUP:
if (GetCapture() == m_hwnd)
{
m_parentVwnd.OnMouseUp(GET_X_LPARAM(lParam),GET_Y_ LPARAM(lParam));
ReleaseCapture();
}
break;

case WM_MOUSEMOVE:
// if (GetCapture() == m_hwnd)
m_parentVwnd.OnMouseMove(GET_X_LPARAM(lParam),GET_ Y_LPARAM(lParam));
break;
}
return 0;


any idea ?

2) in order to better arrange my GUIs (at runtime): is it possible to preview the size (width) of a static text "toto" when displayed through LICE_Font/LICE_CachedFont?

Thanks for any input !

Justin
01-27-2011, 02:05 PM
The first problem looks as though the mouse stays captured after the menu is selected? What does the code that responds to the combo box changed notification look like?

Regarding calculating the size of text, you should be able to use LICE_CachedFont::DrawText() with DT_CALCSIZE, just like Win32.

Jeffos
01-28-2011, 02:53 AM
thank you Justin!

1) My edit wasn't clear enough above (+ the link is outdated now) but I sorted out the 1st issue.
No prob here! The mouse indeed stayed captured after the menu was selected but it was due to a stupid error on my end. I should have read the header twice (where one can read "// return -1 to eat, >0 to capture" for OnMouseDown) rather than finding my error the hard way! So, in case somebody else struggles with that too, the error was:

[...]
case WM_LBUTTONDOWN:
SetFocus(m_hwnd);
if (m_parentVwnd.OnMouseDown(x, y) > 0) // > 0 was missing !!!
SetCapture(m_hwnd);
break;
[...]

2) Your tip put me in the good direction, thanks!
I just use "DT_CALCRECT" instead (for some reasons, I don't have any "DT_CALCSIZE" defined here..)

Justin
01-28-2011, 03:13 PM
Ooops, I meant DT_CALCRECT, my bad ;)