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

Timeout events commented out

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
keinfarbton



Joined: 03 Dec 2005
Posts: 224
Location: Stuttgart - Germany

PostPosted: Thu Feb 16, 2006 4:40 pm    Post subject: Timeout events commented out Reply with quote

Great to hear this project is alive.
While trying to make cyclic widget updates, i realized, the timeout events are deactivated. What is the problem with them?
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Thu Feb 16, 2006 8:53 pm    Post subject: Re: Timeout events commented out Reply with quote

tionex wrote:
Great to hear this project is alive.
While trying to make cyclic widget updates, i realized, the timeout events are deactivated. What is the problem with them?

What you mean? I just used it.
here is the entire program:

(Of course this is using Dool and DUI from the SVN.)

##############################

/*
* this the simplest toolbar possible,
* I'm tired of loosing the my toolbar every time I change the window manager
*/
module tbar.TBar;

private import dui.MainWindow;
private import dui.DUI;
private import dui.Button;
private import dui.Label;
private import dui.Image;
private import dui.VBox;
private import dool.Process;

private import event.TimeoutListener;
private import event.Dispatcher;

private import std.date;
private import std.stdio;

public:
class TBar : MainWindow
{

VBox mainBox;

this()
{
super("TBar");
//setSizeRequest(105,759);

addNewClock();

addButton("konsole", "/usr/share/pixmaps/konsole.xpm");
addButton("kcalc", "/usr/share/pixmaps/kcalc.xpm");
addButton("konqueror", "/usr/share/pixmaps/konqueror.xpm");
addButton("/opt/firefox/firefox", "/opt/firefox/icons/mozicon50.xpm");
addButton("/opt/thunderbird/thunderbird", "/opt/thunderbird/icons/mozicon50.xpm");
addButton("/home/ruimt/devel/D1/Leds/leds", "/home/ruimt/devel/D1/Leds/images/ledsIcon.xpm");

if ( mainBox !is null )
{
add(mainBox);
}

show();
}

void addButton(char[] command, char[] iconName)
{
if ( mainBox is null )
{
mainBox = new VBox(false, 2);
}
mainBox.add(new AButton(command, iconName));
}

void addNewClock()
{
if ( mainBox is null )
{
mainBox = new VBox(false, 2);
}
mainBox.add(new Clock());
}

}

class Clock : Button , TimeoutListener
{

char[][] weekDays;

int testCount;
this()
{
super("Clock");

weekDays ~= "Sun";
weekDays ~= "Mon";
weekDays ~= "Tue";
weekDays ~= "Wed";
weekDays ~= "Thu";
weekDays ~= "Fri";
weekDays ~= "Sat";

setTime();

Dispatcher dispatcher = Dispatcher.getDispatcher();
dispatcher.addTimeoutListener(this, 30 * 1000);

}

public void setTime()
{
d_time lNow;
char[] lNowString;

// Grab the date and time relative to UTC
lNow = std.date.getUTCtime();
// Convert this into the local date and time for display.
lNowString = std.date.toTimeString(lNow)[0..5];
lNowString ~= "\n " ~ weekDays[std.date.WeekDay(lNow)];
//lNowString ~= "\n " ~ weekDays[3];


setLabel(lNowString);
}

bit timeoutCallback()
{
setTime();
return true;
}
}


class AButton : Button
{
char[] command;
this(char[] command, char[] iconName)
{
super(new Image(iconName));
this.command = command.dup ~ " &";
addOnClick(&clicked);
}

void clicked()
{
Process.system(command);
}

}


void main(char[][] args)
{
DUI dui = DUI.dui(args);
new TBar();
dui.go();
}
Back to top
View user's profile Send private message
keinfarbton



Joined: 03 Dec 2005
Posts: 224
Location: Stuttgart - Germany

PostPosted: Fri Feb 17, 2006 7:20 pm    Post subject: Reply with quote

ups.
I found the timeout events in DUI.d commented out.

Thanks for the tipp.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD 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