Still getting mouse inputs while the window is not visible
It still handling the mouse/keyboard input while the form is not visible, is that bug or im just using it wrong ?!
Could you show some code and explain what the problem is?
#include "IconWindow.h"
#include "IconButton.h"
extern DWORD ClientX;
void IconWindow::InitializeComponent()
{
this->SetCaptionBar(false);
this->SetSize(64, 64);
this->SetLocation(ClientX - 53, 178);
printf("Initialized : X: %d => Y: %d\n", ClientX - 53);
IconButton* button = new IconButton();
button->SetLocation(0, 0);
button->GetClickEvent() += ClickEventHandler(std::bind(&IconWindow::button_Click, this, std::placeholders::_1));
this->AddControl(button);
mainForm = new MainForm();
mainForm->SetText("Main Menu");
mainForm->Show(std::shared_ptr<Form>(mainForm));
mainForm->SetVisible(false);
}
void IconWindow::PopulateGeometry()
{
}
void IconWindow::button_Click(Control *control)
{
mainForm->SetVisible(!mainForm->GetVisible());
}
I wanna use it like this.
Replace your button_Click handler with Application::Instance().Toggle();. If you disable the application the input processing is stopped. It is not stopped if you set a form to invisible because there may be other forms visible.
yea, i know that but the thing is I'm already rendering another icon to toggle the another window ingame, that is the problem i was recently edited the whole control class and its cpp file but seems the Control class doesn't handle the current visibility status. I'm just stucked here, really want some help for doing that. also I guess the library doesn't has that feature yet?!
I don't understand what you are trying to do. Do you render an icon somewhere to toggle the gui? This should not work because then both, gui and game, need to process the input at the same time. Easiest solution is just a hotkey to toggle the gui:
auto Toggle = []()
{
Application::Instance().Toggle();
};
Application.Instance().RegisterHotkey(Hotkey(Key::Insert, Toggle));
Exactly im rendering a icon ingame to toggle the gui and i want that job to be possible and thats it
But then there would be a cursor floating around the whole time. If you want to draw a permanent icon you need to extend the Application::Render method. But even then you would need to use Application::Toggle to remove the cursor and let the game handle its input.
I was solved the problem using another way but sometimes i'm getting this error, Do you have any idea for that ? http://prntscr.com/nppfeb
Look at the callstack. The geometry buffer you are trying to draw has already been released and is overwritten with dummy data.
Is there any platform where I can contact you?