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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Dear monks,

I'm writing my first GUI app using wxglade. I'm trying to come up with a sensible MVC-ish architecture.

The way wxglade works is that you can define handlers for events, e.g., a button is pressed, and a subroutine \&handle_button_press (or whatever) is called. In the wxglade interface you can specify the name of the handler, and then when you generate gui code, a stub for the handler is generated as well.

I can imagine the end result being an enormous file with gui code plus lots of stubs I am supposed to fill in in the same file. This seems spaghetti-ish (and not very MVC).

I figured the following could work: I do this code generation thing as wxglade wants me to, then I delete all the handler stubs, and instead write an AUTOLOAD sub that, using $AUTOLOAD calls something like $Model->update( '-message' => $AUTOLOAD ), were the $Model in turn calls $self->notify_listeners( '-message' => $AUTOLOAD ).

I'm wondering if I'm on the right track with this or whether I'm missing something obvious.

Thanks!

In reply to Wx and MVC by rvosa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-20 01:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found