OSHGui icon indicating copy to clipboard operation
OSHGui copied to clipboard

Still getting mouse inputs while the window is not visible

Open sector1337-zz opened this issue 6 years ago • 10 comments

It still handling the mouse/keyboard input while the form is not visible, is that bug or im just using it wrong ?!

sector1337-zz avatar May 16 '19 17:05 sector1337-zz

Could you show some code and explain what the problem is?

KN4CK3R avatar May 16 '19 18:05 KN4CK3R

#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.

sector1337-zz avatar May 16 '19 20:05 sector1337-zz

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.

KN4CK3R avatar May 16 '19 20:05 KN4CK3R

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?!

sector1337-zz avatar May 16 '19 20:05 sector1337-zz

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));

KN4CK3R avatar May 16 '19 20:05 KN4CK3R

Exactly im rendering a icon ingame to toggle the gui and i want that job to be possible and thats it

sector1337-zz avatar May 16 '19 20:05 sector1337-zz

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.

KN4CK3R avatar May 16 '19 20:05 KN4CK3R

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

sector1337-zz avatar May 17 '19 08:05 sector1337-zz

Look at the callstack. The geometry buffer you are trying to draw has already been released and is overwritten with dummy data.

KN4CK3R avatar May 17 '19 08:05 KN4CK3R

Is there any platform where I can contact you?

sector1337-zz avatar May 17 '19 16:05 sector1337-zz