logo       

Re: Making UI creation easier?: msg#00034

Subject: Re: Making UI creation easier?
gerardo castro <gerardo.castro.mtz@xxxxxxxxx> wrote:
> 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*---
> 

A nearly aquivalent perl/Tk script could look like this:

use Tk;
my $mw = MainWindow->new(-width => 400, -height => 300, -title => "Miprograma");
my $b = $mw->Balloon;
my $label1 = $mw->Label(-border => 2, -relief => "raise")->pack;
my $text1text = "Escribe aqui tu texto";
my $text1 = $mw->Entry(-width => 100, -textvariable => \$text1text,
                       -validate => "all", -vcmd => sub { 
$label1->configure(-text => "something like") })->pack;
my $nombreboton;
$mw->Button(-textvariable => \$nombreboton,
            -command => \&functionboton)->pack;
my $texttolargo1 = $mw->Text(-width => 400/10, -height => 400/10)->pack;
$texttolargo1->insert("end", <<EOF);
This text is contained on it
EOF
$b->attach($texttolargo1, -msg => "Put here your text");
MainLoop;

It's slightly longer, because variables are declared, a geometry manager
is explicitely used (there's no pack or grid support in your example),
and your example uses some sugar not found in Perl/Tk like alt="..."
or the on...="..." attributes.

I think that perl programmers are accustomed enough writing perl scripts,
and a html- or xml-like language would be too simple for most but the
simplest problems.

But some of your thoughts there are interesting. You introduced attributes
like -on..., -alt, -value, the inner contents of an <text> tag. Maybe it
would be nice to introduce those options to a yet-to-create higher-level Tk
package --- for those people who want it even easier.

Regards,
        Slaven

-- 
     __o                Slaven Rezic
   _`\<,_               slaven <at> rezic <dot> de
__(_)/ (_)____
______________________________________________________________________________
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
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 majordomo@xxxxxxxxxxxxxxxxxx



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe