logo       


Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Modal dialog not acting modal...: msg#00035

Subject: Re: Modal dialog not acting modal...
Hi Peter,

Code below works.
I'm afraid I don't know enough about Perl and Wx internals to explain
why your original doesn't work which is probably unsatisfactory - but at
least it means you have some working code! Its all in the way Wx::App is
instantiated, I think.

I also removed the variables declared as 'our' from the Test_ui package
as I'm sure they are not what you want. (but this was not cause of problem)

Regards

Mark

#!/usr/bin/perl -w --
my $app = DemoApp->new();
$app->MainLoop();

package DemoApp;;
use strict;
use Wx qw[:everything];
use base qw (Wx::App);

sub OnInit {
    Wx::InitAllImageHandlers();
    my $ui = Test_ui->new();
    $app->SetTopWindow($ui);
    $ui->Show(1);
}


package Test_ui;
use Wx qw[:everything :allclasses];
use Wx::Event qw(EVT_LEFT_UP);
use base qw(Wx::Frame);

sub new {
        my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_;
        $parent = undef              unless defined $parent;
        $id     = -1                 unless defined $id;
        $title  = ""                 unless defined $title;
        $pos    = wxDefaultPosition  unless defined $pos;
        $size   = wxDefaultSize      unless defined $size;
        $name   = ""                 unless defined $name;
        $style = wxDEFAULT_FRAME_STYLE unless defined $style;

        $self = $self->SUPER::new( $parent, $id, $title, $pos, $size,
$style, $name );

        my $main_sizer=Wx::BoxSizer->new(wxVERTICAL);

        $self->{keywords_text} = Wx::TextCtrl->new($self, -1,
                "1. Apples\n2. Bananas\n3. Cherries\n4. Durian",
                wxDefaultPosition, wxDefaultSize,
                wxTE_READONLY|wxTE_MULTILINE|wxTE_DONTWRAP);
        $main_sizer->Add( $self->{keywords_text}, 1, wxEXPAND|wxALL, 2);

        $self->SetAutoLayout(1);
        $self->SetSizer($main_sizer);
        $self->Layout();

        EVT_LEFT_UP( $self->{keywords_text}, \&handle_keywords_left_up);

        $self->{__wordlist} = ['Apples','Bananas','Cherries','Durian'];

        $self->{ISFRAME} = 1;

        return $self;
}

sub handle_keywords_left_up {
        my ($control, $event) =@_;
        my $self = $control->GetParent();
        my $ip = $self->{keywords_text}->GetInsertionPoint();
        my ($col,$row)=$self->{keywords_text}->PositionToXY($ip);
        my @keywords = @{ $self->{__wordlist} };

        print("editing keyword #$row\n");
        return unless $keywords[$row];
        my $newtext=Wx::GetTextFromUser( "Edit keyword $keywords[$row]",
                "Edit keyword $keywords[$row]", $keywords[$row], $self,
0, 0);
        if ($newtext) {
                $keywords[$row]=$newtext;
                my $keyword_text='';
                my $i=1;
                foreach my $k ( @keywords) {
                        $keyword_text .= "$i.\t$k\n";
                        $i++;
                }
                $self->{keywords_text}->SetValue( $keyword_text);
        }

        $event->Skip(1);
}

1;



Peter Theobald wrote:
> I have a TextCtrl with keywords in it. When the user clicks on a keyword I 
> pop 
> up a modal dialog to edit the keyword........


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
db.firebase.por...    text.xml.xalan....    qnx.openqnx.dev...    user-groups.zar...    internationaliz...    kde.devel.konve...    finance.e-gold....    emacs.latex.pre...    gis.therion/200...    web.webmin.gene...    yellowdog.gener...    vserver/2003-08...    redhat.release....    sysutils.tivoli...    xfree86.expert/...    mail.becky.user...    hardware.netapp...    netbsd.ports.xe...    python.distutil...    boot-loaders.gr...    culture.interne...    java.springfram...    activedir/2006-...   
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