FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Entice - utter beginner question!

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
alasdair_fox



Joined: 23 May 2006
Posts: 2

PostPosted: Tue May 23, 2006 7:55 am    Post subject: Entice - utter beginner question! Reply with quote

Hi all!
I've just started fiddling around with D, and i've only just downloaded DFL/Entice today. I am however having some bother with the click event on buttons (i've put a button on the form designer, and tried to add some code for the event handler, but i'm obviously doing it wrong, as it won't compile)

code is as follows :

Code:
 /*
   Generated by Entice Designer 0.7.2
   Entice Designer written by Christopher E. Miller
   www.dprogramming.com/entice.php

   This source code is public domain.
*/

private import dfl.all;


class MyTestForm: dfl.form.Form
{
   // Do not modify or move this block of variables.
   //~Entice Designer variables begin here.
   dfl.button.Button button1;
   //~Entice Designer variables end here.
   
   
   this()
   {
      initializeMyTestForm();
      button1.click ~= &Button1Click;
   }
   
   
   private void initializeMyTestForm()
   {
      // Do not manually edit this block of code.
      //~Entice Designer 0.7.2 code begins here.
      //~DFL Form
      text = "My Test Form";
      clientSize = dfl.drawing.Size(136, 69);
      //~DFL dfl.button.Button=button1
      button1 = new dfl.button.Button();
      button1.name = "button1";
      button1.bounds = dfl.base.Rect(16, 16, 104, 32);
      button1.text = "Test Button";
      button1.parent = this;
      //~Entice Designer 0.7.2 code ends here.
   }
}


int main()
{
   int result = 0;
   
   try
   {
      // Application initialization code here.
      
      Application.run(new MyTestForm());
   }
   catch(Object o)
   {
      msgBox(o.toString(), "Fatal Error", MsgBoxButtons.OK, MsgBoxIcon.ERROR);
      
      result = 1;
   }
   
   return result;
}


void Button1Click(Object sender, EventArgs ea)
{
   //lblSquare.text  = txtInput.text;
   msgBox("test");
}


i get the error message as follows when i compile:

TestAF.d(23): function dfl.event.Event!().Event.opCatAssign (void delegate(Objec
t, EventArgs)) does not match argument types (void(*)(Object sender, EventArgs e
a))
TestAF.d(23): cannot implicitly convert expression (& Button1Click) of type void
(*)(Object sender, EventArgs ea) to void delegate(Object, EventArgs)


i've tried changing a few things about, but i'd be very grateful if someone could point out what i am doing wrong, and what the correct way is. I know that it's the "button1.click ~= &Button1Click;" line, if i comment it out, it compiles fine.

thanks in advance!
Back to top
View user's profile Send private message
alasdair_fox



Joined: 23 May 2006
Posts: 2

PostPosted: Tue May 23, 2006 8:17 am    Post subject: Reply with quote

Oops! finally figured it out, i should have the event handler code inside the main form class. I've slapped myself soundly around the head for asking stupid questions!

Thanks anyway!
Back to top
View user's profile Send private message
hotzenplotz



Joined: 25 Mar 2006
Posts: 15

PostPosted: Tue May 23, 2006 3:08 pm    Post subject: Reply with quote

Laughing There is no stupid questions!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group