Re: Making UI creation easier?

[email protected]
Newsgroups gmane.comp.lang.perl.tk
Message-ID <OFA7EB9C2D.A73A836C-ONC1256F50.005045B6-C1256F50.005117F8@philips.com>



Hi Gerardo,

for your purpose (just making small interfaces with some
elements) I don't really understand what your problem
with Per/Tk is. Using Frames as containers to group
items you can even mix pack and grid in the same GUI
(but please not in the same frame) and get to a decent
layout in no time.

I have done such mini-GUIs quite often and it often takes me
not even 5 minutes to type in the required perl code for the
GUI itself.
I would really suggest that you give 'pack' and 'grid'
a try - MPTK (Mastering Perl/Tk by Steve Lidie and
Nancy Walsh, O'Reilly) is really an excellent reference
for this.

Once you've grasped the idea, I think for your purpose
there's nothing that would be easier to use.
All those GUI builders have learning curves, too - and I
doubt that they are much steeper than the curve for the
native Perl/Tk methods.

Regards,
Gerhard




|---------+------------------------------>
|         |                              |
|         |                              |
|         |                              |
|         |                              |
|         |                              |
|         |    gerardo castro            |
|         |    <gerardo.castro.mtz@gmail.|
|         |    com>                      |
|         |                              |
|         |    Sent by:                  |
|         |    [email protected]|
|         |    DU                        |
|         |                              |
|         |    2004-11-18 12:14 AM       |
|         |    Please respond to gerardo |
|         |    castro                    |
|         |                              |
|---------+------------------------------>
  >---------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                           |
  |           To:   [email protected]                                                                                    |
  |           cc:   (bcc: Gerhard Petrowitsch/STN/SC/PHILIPS)                                                                 |
  |           Subject:    Making UI creation easier?                                                                          |
  |                                                                                                                           |
  |           Classification:                                                                                                 |
  |                                                                                                                           |
  |                                                                                                                           |
  >---------------------------------------------------------------------------------------------------------------------------|




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]



-++**==--++**==--++**==--++**==--++**==--++**==--++**==
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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.