Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1552
  • Last Modified:

PowerBuilder object loses focus

Hi,

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!
0
ssebring
Asked:
ssebring
2 Solutions
 
sandeep_patelCommented:
Hi,

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.

Regards,
Sandeep
0
 
diasroshanCommented:
Hi,

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.SetFocus()
dw_1.SetColumn('<ur columnname>')


Cheers,
Rosh
0
 
ssebringAuthor Commented:
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.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now