two minor issues regarding ofSystemTextBoxDialog

First of all thanks on the great work folks! really handy feature this one ,

just 2 minor things/thoughts though…

in the windows version the window appears on the default window pos upper left because we use CW_USEDEFAULT when we initialize with the CreateWindowEx , unfortunately there is no default function provided by microsoft to sort this easily but it’s not that difficult to manually make it appear in the center either

you can’t use ofGetWidth because it is not inherited in systemUtils.cpp

but what we can do is a little trick using RECT

first declare two ints posx,posy after ifdef TARGET_WIN32

and then… find 2 places in the code below where we use CreateWindowEx();

right after it. paste

RECT rc;  
getWindowRect (dialog, &rc);  
//and then   
posx = (GetSystemMetrics(SM_CXSCREEN) - rc.right)/2;  
posy = (GetSystemMetrics(SM_CYSCREEN) - rc.bottom)/2;  
SetWindowPos( dialog, 0, posx, posy, 240, 140, SWP_NOZORDER | SWP_NOSIZE );  

The other issue is that when you click OK or Cancel on the BOX…

ofGetmousePressed() remains true…

(windows only problem)
The way I deal with this right now is by creating a ofResetMouse() function that clears the pressedMouseButtons set in the ofEvents.cpp/.h
and calling it right after the ofSystemTextBox event finishes

better suggestions are ofcourse welcomed!!

1 Like