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

Container/Box API Suggestion

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



Joined: 05 Nov 2009
Posts: 19

PostPosted: Mon Dec 28, 2009 7:18 am    Post subject: Container/Box API Suggestion Reply with quote

A pattern I have noticed when building GUIs with containers is this:

Code:

VBox vb = new VBox(false, false);
add(vb);
with(vb) {
   // create and add stuff in the VBox
}


Would it be possible update add, pack*, etc (which currently return void) to return the Widget that was passed to it? It would allow some fairly nice constructs like:

Code:

with(add(new Vbox(false, false))) {
   // do stuff with vbox
}


This could even be extended to other void returning methods to allow for chained construction (although I don't know if I'd use it).

Code:

add(new VBox(false, false)).setSpacing(10).add(new HBox(false, false));

Label l = (new HBox).add(new Label("Hello World"));


Unless there are some other reasons not to do this.
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Tue Dec 29, 2009 1:25 pm    Post subject: Reply with quote

I'm not sure.
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