The examples you've given is what I'm doing.So, you've fixed the problem now?
That's not true. If searching is true, it will draw searchText.if (searching == true)Whether or not the variable is true, it doesn't draw the text
window.draw(searchText);
What you need to do is write a complete and minimal example that shows your code and what you are doing wrong so someone can point out what you did wrong.
Maybe if you supplied a minimal and complete example, someone could help you. ::)