simulate button event clicked

Started by billarhos, 31 October 2015, 18:31:00

billarhos

Hi, i am struggling to make a button get pressed from code. The reason i want this is because i have shorcuts to simulate button events.

Example:

if (event.key.code == sf::Keyboard::S)
  pPrintButton->setPressed();


Well, if i use "leftMouseReleased" function it works however the text color stays on a hover(whatever) state.
Is any cure for this?


texus

It seems like button assumed that on mouse release you would be back in hover state (which makes some sense since internally tgui can only call that function when the mouse is effectively on top of the button). Other widgets don't seem to have this problem. Code on github has been updated to make it go back to normal state when the mouse is not on top of the button.

billarhos