TD-20987: SetFocus not working from Tree item of Dialog window to Form
TD-20987: SetFocus not working from Tree item of Dialog window to Form
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. Version - TD 6.2 SP1
OS - Windows 7 & 8
Thank you in advance
Regards
Siva A
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. 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.
Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form
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
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
Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form
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
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
-
- Founder/Site Admin
- 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
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)
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.
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()
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

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

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form
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
I use SAM_DoubleClick instead of SAM_ItemSelected and there is the same issue.
I hope that issue will be fixed next time.
Enrico
Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form
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
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
Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form
Hi:
I have logged a defect TD-20987 to resolve this issue
Thanks for the information.
Regards,
Victor Espinal
I have logged a defect TD-20987 to resolve this issue
Thanks for the information.
Regards,
Victor Espinal
Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form
FYI, this will be solved with TD 6.2 SP4.
Merry Christmas to all.
Cheers,
Victor Espinal
Merry Christmas to all.
Cheers,
Victor Espinal
Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form
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
It seems the TD- 20987 is not available in the fix list. Can you please confirm whether this is fixed?
Thanks!
Siva A
Re: TD-20987: SetFocus not working from Tree item of Dialog window to Form
it was fixed on TD 6.2 SP4
Thanks
Victor
Thanks
Victor
Who is online
Users browsing this forum: [Ccbot] and 5 guests