Re: Question about dialog code

From: Dom Lachowicz (domlachowicz_at_yahoo.com)
Date: Wed Jan 07 2004 - 00:01:53 EST

  • Next message: Ingo Lantschner: "Abiword w/o Gnome impossible?"

    > switch ( abiRunModalDialog ( GTK_DIALOG(window),
    > pFrame, this, BUTTON_CANCEL, false ) )

    > I take it that abiRunModalDialog pauses the flow of
    > control until the user click on OK or Cancel. This
    > works fine, although not at all what I am used to.

    The preferred usage in GTK 2.0 for modal dialogs is to
    do gtk_dialog_run(). The buttons all emit a response
    code when they're pressed. Escape emits a "cancel"
    type signal.
     
    > Why don't we have OK and Cancel send events, catch
    > those events and close the dialog like that, instead
    > of this abiRunModalDialog. Is this the normal way
    > things are done in GTK, or is there something
    > special
    > being done here that I am missing?

    This is the normal way things are done in GTK 2.x. I
    made a convenience method to set the window's parent,
    connect it to its help page, set the default button
    and widget, etc...
     
    > Anyway as a side note to this, would it be better
    > for
    > the OK button to only enable when there is a valid
    > range entered (such as my firebird print dialog
    > does)
    > or to allow the user to push print and then give an
    > error message (like the save as dialog does)?

    The only time I'd see the "OK" button getting disabled
    is when 'To' is greater than 'From' or if the # of
    copies is 0. Then again, I might set up the UI so that
    those choices could never be entered. Feel free to
    make such a change. I personally advocate using the
    Gnome build and the GnomePrintDialog.

    Dom

    __________________________________
    Do you Yahoo!?
    Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
    http://hotjobs.sweepstakes.yahoo.com/signingbonus



    This archive was generated by hypermail 2.1.4 : Wed Jan 07 2004 - 00:01:17 EST