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

TextBox -> selectAll

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



Joined: 24 Jul 2005
Posts: 26

PostPosted: Sun Jul 24, 2005 10:37 am    Post subject: TextBox -> selectAll Reply with quote

Hi,

It seems selectAll is not working. At first I thought it was only a stub; but the source code sends the Windows selection message.

I have created a small example that demonstrates the non-working functionality:

Code:


import dfl.all;
import std.string;

class MainForm: Form
{
   TextBox textBox;
   Button clearButton;
   Button selectButton;

   this()
   {
      text = "Textbox demonstration";

      textBox = new TextBox;      
      textBox.parent = this;

      clearButton = new Button;
      clearButton.text = "Clear";
      clearButton.parent = this;
      clearButton.click ~= &clearHandler;

      selectButton = new Button;
      selectButton.text = "Select all";
      selectButton.parent = this;
      selectButton.click ~= &selectHandler;

      handleResize();
   }

   private void selectHandler(Object sender, EventArgs e)
   {
      printf("selectHandler invoked ...\n");
      textBox.selectAll();
   }

   private void handleResize()
   {
      const int space = 5;

      textBox.width = clientSize.width;
      textBox.text = std.string.toString(width) ~ ", " ~ std.string.toString(height);   

      clearButton.left = clientSize.width - clearButton.width;
      clearButton.top = clientSize.height - clearButton.height;

      selectButton.left = clearButton.left - space - selectButton.width;
      selectButton.top = clientSize.height - selectButton.height;
   }

   private void clearHandler(Object sender, EventArgs e)
   {
      textBox.clear();
   }

   protected void onResize(EventArgs args)
   {
      handleResize();
   }
}

int main()
{
   Application.run(new MainForm);
   return 0;
}

Back to top
View user's profile Send private message
tim



Joined: 24 Jul 2005
Posts: 26

PostPosted: Sun Jul 24, 2005 10:46 am    Post subject: Reply with quote

Oh and Chris, really fantastic GUI toolkit, judging from what I've seen so far! Seems you've been inspired by the Delphi VCL?

Using WinRAR I can compress the above example to only 89 KB! Absolutely unbelievable! If you use Java or C#, you need to ship at least (!) 10 MB to ensure the application runs everywhere; if you use VB or MFC, you must ship at least 1 MB.

A 89 KB statically linked application that has been created using a Java-like language with true modules and automatic garbage collection and a GUI toolkit blows my mind!
Back to top
View user's profile Send private message
Chris Miller



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

PostPosted: Sun Jul 24, 2005 12:09 pm    Post subject: Re: TextBox -> selectAll Reply with quote

tim wrote:
Hi,
It seems selectAll is not working. At first I thought it was only a stub; but the source code sends the Windows selection message.


Hey, thanks.
Put textBox.focus(); in there before textBox.selectAll();
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