compiling enigma plugin ERRORS

hello.

i want to build plugin that when i put a code the programme add this code to the url and connect to the host for activing account




the error is

1
2
3
4
Active.cpp: In member function `void Fetcher::fetch()':
Active.cpp:173: error: `mytext' undeclared (first use this function)
Active.cpp:173: error: (Each undeclared identifier is reported only once for each function it appears in.)
make: *** [Active.o] Erreur 1


mytext is declared in ( class eBibleMainWindow: )
1
2
// the textinput
eTextInputField *mytext;


and it called from another class

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// The Class declaration of our Http Connection system
class Fetcher : public eWindow
{
	// The temp file in which we will store the download data
	eString tempPath;
	// internal pointers and functions of download connection
		
public:
	Signal1<void,int> downloadDone;
	void fetch();
	
};

// The Class declaration of our Main Window
class eBibleMainWindow: public eWindow
{
	// the label to show the text
	eLabel *label;
	// the button to start connection
	eButton *ok;
	// the textinput
        eTextInputField *mytext;
	// the connection object
	Fetcher theFetcher;
	
public:
	// the constructor.
	eBibleMainWindow();
	// function to call when button is pushed 
	void Wconnect();
	
		// the destructor.
	~eBibleMainWindow();
};

eBibleMainWindow::eBibleMainWindow(): eWindow(1)
{
	inDownloadFlag = 0;
		// move our dialog to 100.100...
	cmove(ePoint(100, 150));
		// ...and give x and y dimensions.
	cresize(eSize(460, 200));
		// set a title.
	setText("Server Activation Tool... By .:: ZEOS ::.");
	
	

	    // create textinput
            mytext=new eTextInputField(this);
            // give position
            mytext->move(ePoint(160, 70));
            // give size
            mytext->resize(eSize(130, 40));
            // set max number of characters
            mytext->setMaxChars(13);
            mytext->setUseableChars("1234567890");
            //mytext->setText(codeentry);
            // show a frame decoration
            mytext->loadDeco();
	// create button and set properties
	ok = new eButton(this);
	ok->setText("Activate");
	ok->move(ePoint((clientrect.width() - 140)/2, clientrect.height() - 60));
	ok->resize(eSize(130, 40));
	ok->setShortcut("green");
	ok->setShortcutPixmap("green");
	
    CONNECT(ok->selected, eBibleMainWindow::Wconnect);
		
}

void eBibleMainWindow::Wconnect()
{
		// Set the flag that indicates we are in downlading status
	if(!inDownloadFlag) {	
		inDownloadFlag = 1;
		// Hide Label to change text
		label->hide();
		
		// Show the label with New Text
		label->show();
		// Function to call when donwload is complete
		CONNECT(theFetcher.downloadDone, eBibleMainWindow::downloadDone);
		// Set the flag indicates that we are starting connections
		downloadDoneFlag = 0;
		// Call function to start http connection
		theFetcher.fetch();
	}
}

void Fetcher::fetch()
{
	// declare variable
	eString url, code;
	code = mytext->getText();
	// assign to the variable the url we want to connect
	url = "http://www.host.com/activate.php"+code;
	// assign to class variable the temporary file we will use to store the dowanloaded data
	tempPath = "/var/tmp/bdemo.sh";
	// inizialize the control error flag
	int error = 0;
	// start connection
	// Show a Messagebox in case of connection error
	if(!connectionP || error)
	{	eMessageBox msg("Error... network connections (" + eString().sprintf("%d", error) + ")", _("Details"), eMessageBox::btOK);
		msg.show();     msg.exec();     msg.hide();
	}
	else
	{
		//if the connection is estabilished start the download funcions
		CONNECT(connectionP->transferDone, Fetcher::transferDone);
		CONNECT(connectionP->createDataSource, Fetcher::createDownloadSink);
		// set the user-agent name
		connectionP->local_header["User-Agent"] = "Super-Code";
		connectionP->start();
	}
}
Last edited on
The problem is that your Fetcher object, called theFetcher, has no member variable called mytext.

One solution would be to make a new object called mytext in the Fetcher class.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Fetcher : public eWindow
{
	// The temp file in which we will store the download data
	eString tempPath;
	// internal pointers and functions of download connection
	eHTTPConnection * connectionP;
	eHTTPDataSource * dataSinkP;
	void transferDone(int err);
	eHTTPDataSource * createDownloadSink(eHTTPConnection *conn);	
public:
	Signal1<void,int> downloadDone;
	void fetch();
        eTextInputField *mytext;
};


Then where you create the object it points to in eBibleMainWindow::eBibleMainWindow(): eWindow(1),

1
2
3
  // create textinput
            mytext=new eTextInputField(this);
            theFetcher.mytext = mytext;


and then your fetcher class will have an object called mytext, which will be a pointer of the right type and will point to the same object as the one you made in the eBibleMainWindow::eBibleMainWindow()

It would be up to you to make sure that the two pointers always pointed to the same object.
Last edited on
thanks thanks thanks thanks Mr Moschops Now it work perfectly ..... thanks very much...
Topic archived. No new replies allowed.