Making UI creation easier?
gerardo castro <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
I have used perl/tk two or threee times, only because its very hard. I
need it just for making small interfaces with two textboxes, a combo,
some buttons a list, etc. And I found it very hard.
So I think it is posible to make an intermediate language to create
the UI (I know there are IDES like komodo, but they are harder). I
thougt maybe an html like language could be cool and give speed.
Here is the code I was talking about:
---*BEGIN*---
<mainwindow width=400 height=300 title="Miprograma" id=mw>
<label id="label1" border=2 relief="raise">
<text value="Escribe aqui tu texto" id=text1 size=100
onchange="perl:label1->text = 'something like'">
<button textvariable="perl:$nombreboton" onclick="funcionboton">
<text id=textolargo1 height=400 width=400 alt="Put here your text">
This text is contained on it
</text>
<mainwindow>
<perl>
put code for the script here
</perl>
---*END*---
##ANd here the code to parse the 'html-like'
foreach $tag(@tags){
#get the id (the variable name)
$ident=$tag->shiftparam('id');
$tooltip=$tag->shiftparam('alt');
#decode the events as callbacks
%events=$tag->shiftparams('^on');
%callbacks=proccessEvents(\%events);
#create the widgets
${$ident}=new ${$tag}($tag->allparams,%callbacks);
#attach the ballon tooltips
new ballon($tooltip,bind=>\${$ident});
}
function processEvents{
my(%evs)=@_;
my %callbacks={};
foreach($k = keys(%evs)){
if($k eq "onclick"){
$callbacks{'command'}=$evs{$k};
}elsif($k eq 'onchange'){
$callbacks{'change'}=$evs{$k}
}else{
#remove the 'on' and append to %callbacks
}
}
Any parameter to the widget could be passed as an argument in the tag (as easy).
The id, is the variable handle for the widget.
The callbacks will be the onclick, onchange, reinterpreted for this
use. And there could
be an event like onDelete, onHome (putting an 'on' before the
autenthic callback).
It would be acceptable that any widget non-prepared could be inserted
without any change to the code
And now... do you think this is possible? is it useful? does it make sense?
maybe I am mad?
I need your opinions. All comments appreciated. And of course, help is welcome.
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]