Results 1 to 7 of 7
  1. #1

    Problem with isEnabled


    I'm having an issue with a toolbar button in a java application. It's a save button and therefore is only enabled if a change has been made. I'd like to check if it is enabled before closing the window, so that I can press it as required.

    However, the code fails with an ObjectNotFoundException when the object is disabled, instead of simply returning false. In both states, "highlight" works correctly and always get's the correct object. It's just at runtime it fails.

    Here's the code:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">if (Save().isEnabled())
    }</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Pretty basic stuff!! The object is defined as:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">.class javax.swing.JButton 100
    .classIndex 2 50
    iconDescription Save16.gif 50
    name Save Item 100</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">And the error:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">exception_name = com.rational.test.ft.ObjectNotFoundException
    exception_message = Looking for [XDE.MyGuiTestObject(Map:Save)], best failing
    candidate score(25000) was [{accessibleContext.accessibleRole=push button,
    toolTipText=About Kernel Configuration Tool, accessibleContext.accessibleName=,
    iconDescription=About16.gif, name=About Item, .classIndex=7}]
    script_name = XDE.Admin
    script_id = XDE.Admin.java
    line_number = 76
    exception_stack = at com.rational.test.ft.object.interfaces.GuiTestObje ct.isEnabled(Unknown Source)
    at XDE.Admin.allowDebugUpdates(Admin.java:76)
    at XDE.Admin.testMain(Admin.java:28)</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Any help would be appreciated! I could catch the Exception in java and handle it appropriately, however this really should just work!

  2. #2

    Re: Problem with isEnabled

    I have faced the same problem with isEnabled.

    You can use Exists() functions it will work fine.

  3. #3

    Re: Problem with isEnabled

    This works just great, seems like isEnabled is entirely the wrong function for what I wanted; exists() is perfect.

    Thanks, only just got around to checking this!

  4. #4

    Re: Problem with isEnabled

    I am finding that an object exists, but is not enabled. I'm not finding a function to help:

    .classIndex 0 50
    .priorLabel Amount 25
    accessibleContext.accessibleRole text 100
    name TransactionNumberField 100

  5. #5

    Re: Problem with isEnabled

    nevermind... reverse psycological programming worked it out.

  6. #6

    Re: Problem with isEnabled

    Use this...it works a lot better

    targetObject.isPointInObject(targetObject.getScree nPoint());

    If .exists returns TRUE and still its not enabled, this may work by returning FALSE.

    What it does...it sees if the required object is visible ON SCREEN!!!
    Many times object exists but is not visible( div tags messages) and in those times this would work.

    Let me know if this was useful


  7. #7

    Re: Problem with isEnabled

    Wow. Talk about great timing. I just came across this issue today in a collapsable tree.

    However, this doesn't work for me. isShowing() and exists() always return true on this object, isEnabled always returns false and your solution always returns false, regardless of whether or not the object is showing. It's a javascript tree I'm working with.

    I did find a solution however. In the tree, the child object is essentially behind the parent object. Your idea of using screen points came through...I found that when the object is not showing, object.getScreenRectangle().height was equal to zero, so I could use that as a valid "isDisplayed" test for this object.

    I guess every object is different, especially when you throw javascript into the pot. [img]images/icons/frown.gif[/img]



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 07:49 PM.

Copyright BetaSoft Inc.