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

Problem with click-event

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



Joined: 13 May 2007
Posts: 2

PostPosted: Mon May 14, 2007 7:50 am    Post subject: Problem with click-event Reply with quote

Hello

I've got a problem with DFl: When I try to compile a program with a click-event, I get the following message:
Code:

D:\PROGRA~3\dmd\import\dfl\event.d(219): static assert  "DFL: Event handler must be a delegate"


I've got no idea what I'm doing wron, so please tell me.

Whole SC:
Code:

private import dfl.all;
private import std.string;

int main()
{
   Form myForm;
   Label myLabel;
   Button myButton;

   myForm=new Form;
   myForm.text="Click-Event-Test";

   myLabel=new Label;
   myLabel.font=new Font("Tahoma", 14f);
   myLabel.text="1. Text";
   myLabel.location=Point(10, 10);
   myLabel.size=Size(20, 20);
   myLabel.parent=myForm;

   myButton=new Button;
   myButton.text="Change text";
   myButton.location=Point(25, 25);
   myButton.parent=myForm;
   myButton.click ~=&tc;

   return 0;
}

private void tc(Object sender, EventArgs ea)
{
   myLabel.text="2. Text";
}


I'm hoping that you guys can help me

Greetings

The Guardian
Back to top
View user's profile Send private message
Carlos



Joined: 19 Mar 2004
Posts: 396
Location: Canyon, TX

PostPosted: Mon May 14, 2007 8:19 am    Post subject: Reply with quote

Put tc inside of main, or make it a non-static class function.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
The Guardian



Joined: 13 May 2007
Posts: 2

PostPosted: Tue May 15, 2007 9:01 am    Post subject: Reply with quote

Well thanks, but could you post some SC, how you would have done it?
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Tue May 15, 2007 10:07 am    Post subject: Re: Problem with click-event Reply with quote

Many examples come with the DFL download. If you used the installer, you can easily find them from your start menu.

Here's some code: http://paste.dprogramming.com/dpwm1i9f.php
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