Solved TD-20987: SetFocus not working from Tree item of Dialog window to Form

Report TD 5.x and 6.x bugs and possible workarounds.
a_sivababu
India
Posts: 505
Joined: 10 Mar 2017, 08:46
Location: Chennai,India

TD-20987: SetFocus not working from Tree item of Dialog window to Form

Post by a_sivababu » 16 Jun 2014, 16:09

Hi All,
We have implemented Tree control menu in dialog window to create the form window in run time. However the focus is not setting in form window after creation. It looks like the focus is staying back in tree item. We tested this through button from dialog window and from Menu of MDI. both works fine.

So, Is this bug or is there any unknown tree function that helps to clear the focus from tree item?

Sample is also attached here.
Test_Focus.zip
Version - TD 6.2 SP1
OS - Windows 7 & 8


Thank you in advance

Regards
Siva A
You do not have the required permissions to view the files attached to this post.

VEspinal

Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form

Post by VEspinal » 16 Jun 2014, 22:08

Hi:

Yes, there is.

Try the following on you app and it will work.
!!CB!! 174
If strMenuText='Open Window'
Call SalTreeReset( tree1, TRUE )
Call CreateWindow()

HTH

Regards,
Victor Espinal

a_sivababu
India
Posts: 505
Joined: 10 Mar 2017, 08:46
Location: Chennai,India

Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form

Post by a_sivababu » 17 Jun 2014, 06:11

Dear Victor,
Thanks for your quick response on this. However, We have already tried using SalTreeReset() but al the values in Tree item are cleared as we are currently filling the information in run-time. So, I should repopulate the menu from table for each and every click of the menu item.

Could you please let us know if there is any other work around other than SalTreeReset() as this is not viable solution since we get more flickering when we repopulate the tree items for each click?


Thanks
Siva A

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3512
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form

Post by Dave Rabelink » 17 Jun 2014, 07:10

Hi Siva,

I tried everything to get the form activated but nothing helps:

- Posting msg to the form activating itself
- First set the focus on another object (this fails also, focus is kept on the tree)
- After create complete of form posting msg to itself to activate it
- Using WinApi SetForegroundWindow / SetActiveWindow using postmsg after creation

Seems the tree wants to keep the focus. Looking at Spy++ for the messages I see a forced WM_SetFocus after creation of the form.
So the tree IMHO has a bug.

But fortunately I could find a workaround (at least on my system)

Code: Select all

On SAM_ItemSelected
   Set strMenuText = SalTreeGetItemText( hWndItem, wParam )
   If strMenuText='Open Window'
      Call SalPause( 1 )
      Call CreateWindow()
Mind the SalPause before the CreateWindow. This seems to break the set focus issue of the Tree.
I also tried using a timer with 1 ms and that works also.

Please try this to see if this helps on your system.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

EWetzel
Germany
Posts: 272
Joined: 07 Mar 2017, 12:08
Location: Germany

Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form

Post by EWetzel » 17 Jun 2014, 19:19

Hi,

I use SAM_DoubleClick instead of SAM_ItemSelected and there is the same issue.

I hope that issue will be fixed next time.

Enrico

a_sivababu
India
Posts: 505
Joined: 10 Mar 2017, 08:46
Location: Chennai,India

Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form

Post by a_sivababu » 18 Jun 2014, 17:51

Dear Dave,
Excellent Work around solution and it works well with my complete menu functionalities. Thanks a lot for this solution.

I had tried few solution from your list but stopped trying as I could not get any spark for this problem.

It would be great if Gupta resolve this issue in the next service pack.

Thank you once again.

Regards,
Siva A

VEspinal

Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form

Post by VEspinal » 18 Jun 2014, 18:45

Hi:

I have logged a defect TD-20987 to resolve this issue

Thanks for the information.

Regards,
Victor Espinal

VEspinal

Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form

Post by VEspinal » 24 Dec 2014, 15:51

FYI, this will be solved with TD 6.2 SP4.

Merry Christmas to all.

Cheers,
Victor Espinal

a_sivababu
India
Posts: 505
Joined: 10 Mar 2017, 08:46
Location: Chennai,India

Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form

Post by a_sivababu » 09 Jul 2015, 03:59

Hi Victor,
It seems the TD- 20987 is not available in the fix list. Can you please confirm whether this is fixed?

Thanks!
Siva A

VEspinal

Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form

Post by VEspinal » 09 Jul 2015, 17:52

it was fixed on TD 6.2 SP4

Thanks
Victor

Return to “Bug Reports”

Who is online

Users browsing this forum: [Ccbot] and 5 guests