View previous topic :: View next topic |
Author |
Message |
tim
Joined: 24 Jul 2005 Posts: 26
|
Posted: Sun Jul 24, 2005 10:37 am Post subject: TextBox -> selectAll |
|
|
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 |
|
|
tim
Joined: 24 Jul 2005 Posts: 26
|
Posted: Sun Jul 24, 2005 10:46 am Post subject: |
|
|
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 |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Sun Jul 24, 2005 12:09 pm Post subject: Re: TextBox -> selectAll |
|
|
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 |
|
|
|