These two methods are used to create the illusion of "sensitive" entry fields. They cause the text entry field of a PtText or PtComboBox to be shaded and uneditable when text should not be entered, or unshaded and editable when text can be entered. Giving the same name to each method allows us to apply it to either type of widget regardless of which widget. We unset a widget flag using the Gamma cons function, as explained in the Specifying Widget Flags section of the Classes chapter of the Gamma/Photon manual.
/*-------------------------------------------------------------------- * Method: PtText.set_sensitive * Returns: an integer * Description: Changes the sensitivity of a PtText widget. Called by * HistoryWindow.allow_entry_values. *------------------------------------------------------------------*/ method PtText.set_sensitive (val) { if (val != 0) { self.text_flags = Pt_EDITABLE; self.fill_color = 0xffffe5; } else { self.text_flags = cons(Pt_EDITABLE, nil); self.fill_color = 0xd0d0d0; } }
/*-------------------------------------------------------------------- * Method: PtComboBox.set_sensitive * Returns: an integer * Description: Changes the fill color of a PtComboBox widget. Called * by HistoryWindow.allow_entry_values. *------------------------------------------------------------------*/ method PtComboBox.set_sensitive (val) { if (val != 0) { self.list_flags = cons (Pt_LIST_INACTIVE, nil); self.fill_color = 0xffffe5; } else { self.list_flags = Pt_LIST_INACTIVE; self.fill_color = 0xd0d0d0; } }
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.