[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qftestJUI] Using check node to find state of JButton doesn't work?
Hello Bill, Conceptually a JButton doesn't have a selected state. Technically it has one, because it is selected temporarily while it's being pressed, but it will not stay selected. If you override JButton instead of JToggleButton and give it the functionality to stay selected, that's fine, but if we changed the standard checks to include a selected check for all buttons, it would be available as a choice in many situations where it isn't really applicable. A better solution would be an extension API similar to NameResolvers that allows you to register arbitrary checks for your custom component classes. That way one could also add a text check to a canvas that displays some text but is not a text field, etc. I think that's the way we'll go for version 2. Best regards, Greg William Deegan <bill.deegan@?.com> writes: > Gregor > > what's the class of the button? If you're not sure, set the option > > "Record->Components->Record system classes only" and record the button > > in a new test-suite, then look at the class attribute in the component node. > > The class of the button is : JButton > Any reason you don't have selected for JButton? > > I asked the developer why it wasn't JToggleButton. ( he inherited the code from > another developer), and he's since changed it. > But, the JButton does have a isSelected() method, so perhaps it would be worthwhile > to allow a selected check on a JButton? > > > Currently qftestJUI treats JToggleButton (and thus JCheckBox and > > JRadioButton), as well as JCheckBoxMenuItem and JRadioButtonMenuItem > > as selectable and offers the appropriate check. Have we missed > > something? Pure AWT components at least. > > > > > Anyway, you can use Jython for the check: > > com = rc.getComponent("id of button") > > rc.check(com.isSelected(), "Check button selected state") > I did get the above logic working, but it would be nice to avoid having > to do this for semi-standard widgets. > > Thanks, > Bill > > > > Best regards, > > Greg > > William Deegan <bill@?.com> writes: > > > >>Greetings, > >> > >>I'm trying to check the state of a jbutton before clicking it > >>to create procedures for setting/clearing the button. > >> > >>Unfortunately I cannot check the state, when I try to create a check node > >>on the button I'm presented with the following possibilities: > >>* Text > >>* Enabled State > >>* Image > >>* Image (Visible Region) > >>* Geometry > >> > >>What I'd like is a "is selected" to check if the button is pushed or not. > >>Am I missing something? > >>Can this be done using Jython? > >> > >>Thanks, > >>Bill > >>_______________________________________________ > >>qftestJUI-list mailing list > >>qftestJUI-list@?.de > >>http://www.qfs.de/mailman/listinfo/qftestjui-list > > > > > > _______________________________________________ > qftestJUI-list mailing list > qftestJUI-list@?.de > http://www.qfs.de/mailman/listinfo/qftestjui-list -- Gregor Schmid Gregor.Schmid@?.de Quality First Software GmbH http://www.qfs.de Tulpenstr. 41 Tel: +49 8171 919870 DE-82538 Geretsried Fax: +49 8171 919876