PowerBuilder object loses focus

Posted on 2006-04-04
Last Modified: 2013-12-26

I'm working on an adopted PowerBuilder app that does the following steps in a window:

      Inserts a new row (insert is triggered from menu item)
      Validates mandatory fields of the new row before save
      Returns a message if there is missing info
      Returns to the insert screen with focus on the failed validation object

All other windows in the app do this fine, but this new window (which has several bugs) will not hold the object focus after the validation message - it focuses on the 1st object (which has correct data) instead. During debug, the focus is on the object that failed validation, then somewhere during the last steps it loses it's setting - this is where maybe a suggestion could come in (i.e. what attribute should I check for).

There is an incredible amount of behind the scene work redrawing 18 tab selection windows - making it difficult to figure good breakpoints.  Haven't recognized a pattern of the good windows vs. this new window so following the good guys hasn't helped.

Any thoughts, suggestions?

Thank you!
Question by:ssebring
    LVL 14

    Accepted Solution


    First you search for 'POST'. Might be dw_1.Post SetColumn('abc') OR dw_1.Post SetRow(1) is used.

    So what happens is post will put this command in message queue and once your script is over it agains sets focus on the said column and row. If this window is inherited from other window then there are possiblity that it is done in ancestor also.

    And as you said it redras tab selection search for Post SelectTab(). Inshort POST must be creating the problem.

    LVL 18

    Assisted Solution


    just to add to what sandeep said... look for setcolumn or setfocus... these methods are responsible for setting focus...

    if nothing seems to help and ur finding it like hell to hunt for the bug... take the easy route...

    last line of code write...
    dw_1.SetColumn('<ur columnname>')


    Author Comment

    I should have asked sooner!  By searching POST I was able to narrow the issue down quickly, compare the broken event with one of the 'good guys' and find the culprit statement.  So easy.  Thank you! Also thank you to Rosh for the alternative direction.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now