macro help C++

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
dragonMan
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sun Jun 06, 2021 10:25 am

macro help C++

Post by dragonMan »

hello,

Code: Select all

EVT_BUTTON(02, Logclick)
void Logclick(wxCommandEvent& evt, wxString Pass);
it no work guys pls help
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: macro help C++

Post by doublemax »

Too little information. Post more code, especially the begin/end of the event table macro and the context of the Logclick method.

But i can already say:
1) The event handler must be a class method if you use a static event table
2) You can't change the parameters of an event handler. A EVT_BUTTON event handler only has "wxCommandEvent& evt" as parameter, nothing else.
Use the source, Luke!
dragonMan
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sun Jun 06, 2021 10:25 am

Re: macro help C++

Post by dragonMan »

i give now man!!1

pls fix if u can am new in programming man

Code: Select all

#pragma once
#include "wx/wx.h"
class cMain : public wxFrame
{ 
public:
	cMain();
	~cMain();

	
	
public:
	wxButton* m_btn1 = nullptr;
	wxButton* button = nullptr;
	wxTextCtrl* daBox = nullptr;
	wxStaticText* user_text = nullptr;
	wxTextCtrl* zuz = nullptr;
	wxStaticText* pass_text = nullptr;
	void Logclick(wxCommandEvent& evt, wxString Pass);
	void OnBUTclick(wxCommandEvent& evt);
	wxDECLARE_EVENT_TABLE();

};


and here man!!1

Code: Select all

#include "cMain.h"

wxBEGIN_EVENT_TABLE(cMain, wxFrame)
EVT_BUTTON(02, Logclick)
EVT_BUTTON(9245, OnBUTclick)
wxEND_EVENT_TABLE()
cMain::cMain() : wxFrame(nullptr, wxID_ANY, "Rares", wxPoint(30, 30), wxSize(800, 600))
{
	m_btn1 = new wxButton(this, 9245, "Login", wxPoint(10, 10), wxSize(150, 50));
	button = new wxButton(this, 02, "Create Account", wxPoint(200, 10), wxSize(150, 50));/////////////902
	daBox = new wxTextCtrl(this, 5, "",wxPoint(10, 130), wxSize(100, 50));//
	zuz = new wxTextCtrl(this, 999, "", wxPoint(10, 250), wxSize(100, 50));//
	user_text = new wxStaticText(this, 201, "User:", wxPoint(10, 110), wxSize(150, 50));
	pass_text = new wxStaticText(this, 4, "Password:", wxPoint(10, 230), wxSize(150, 50));
}

cMain::~cMain()
{

}

void cMain::Logclick(wxCommandEvent& evt, wxString Pass) {
	
}


void cMain::OnBUTclick(wxCommandEvent& evt) {
	
	

}
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: macro help C++

Post by doublemax »

In principle that looks ok. The problem is probably just that you're using hard-coded IDs that may collide with internal IDs. Your own IDs should start at wxID_HIGHEST+1
Attachments
cMain.h
(417 Bytes) Downloaded 52 times
cMain.cpp
(1.27 KiB) Downloaded 53 times
Use the source, Luke!
dragonMan
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sun Jun 06, 2021 10:25 am

Re: macro help C++

Post by dragonMan »

loloollol.png
loloollol.png (18.88 KiB) Viewed 1214 times

MAN IT ERROR WHY!!?$?!?$!?

Also it says that the exe file was not found!! I didn't delete it or something.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: macro help C++

Post by doublemax »

For testing I added a new wxApp instance to cMain.cpp. You need to remove it.
Use the source, Luke!
Post Reply