simulate button event clicked
« on: 31 October 2015, 18:31:00 »
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:
Code: [Select]
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

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: simulate button event clicked
« Reply #1 on: 31 October 2015, 18:49:46 »
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.

Re: simulate button event clicked
« Reply #2 on: 31 October 2015, 19:05:39 »
thanks texus