Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Change the Behaviour of a Button in Tk::Dialog

by zentara (Archbishop)
on May 15, 2017 at 16:32 UTC ( [id://1190323]=note: print w/replies, xml ) Need Help??


in reply to Change the Behaviour of a Button in Tk::Dialog

Hi choroba,

ideally something like $dialog->get_button_by_text('OK');).

The perldoc fro Tk::Dialog says it has the same advertised widgets as Tk::DialogBox, which is shows the buttons available as B_"button-text". So in your case it would be

my $button_ok = $dialog->{SubWidget}{B_OK};

I'm not really a human, but I play one on earth. ..... an animated JAPH

Replies are listed 'Best First'.
Re^2: Change the Behaviour of a Button in Tk::Dialog
by Discipulus (Canon) on May 15, 2017 at 17:49 UTC
    Hi ++zentara, as always you got the simplest and clearest solution, but:

    > The perldoc fro Tk::Dialog says it has the same advertised widgets as Tk::DialogBox

    I cannot find this explicitally said, I only see Tk::DialogBox in the see also section.

    When i read the doc of Tk::Dialog i've not understood what advertised was supposed to mean. It is a general Tk concept?

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      Hi Discipulus, right in the link you gave to Tk::Dialog it says:

      ADVERTISED WIDGETS
      Because Tk::Dialog is a subclass of Tk::DialogBox it inherits all the advertised subwidgets of its superclass: e.g. "B_button-text", where 'button-text' is a Button's -text value. Additionally, Tk::Dialog advertises:

      Yes, advertised widgets are a general feature of Tk, and most compound widgets will have them. See perldoc Tk::mega . All subclasses of mega widgets inherit the parent widgets advertised widgets.


      I'm not really a human, but I play one on earth. ..... an animated JAPH
        ah! i was reading http://search.cpan.org/~ni-s/Tk/pod/DupName/Dialog.pod instead of http://search.cpan.org/dist/Tk/pod/Dialog.pod !!

        Infact i'm at home with some line of fever but i was wondering if i was going blind and why i was not seing the same of you..

        Nothing worst than read the wrong doc!

        L*

        There are no rules, there are no thumbs..
        Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re^2: Change the Behaviour of a Button in Tk::Dialog
by choroba (Cardinal) on May 15, 2017 at 19:32 UTC
    Thanks, that's exactly what I needed. Somehow, I overlooked the part in Tk::DialBox . The code is now shorter by 7 lines!
    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1190323]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-24 17:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found