Uniface TabEx (How Form Container Lose Focus? )

Author: lorenzo.are@gmail.com (lorenzo.arellano)

Hello, We´re trying to use the TabEx widget and it works great!! We know that the TabEx has a Form Container or the capacity to open Contained Forms. We use some TabEx in the "Value Changed Trigger" with a simple selectcase: selectcase tab     case "things"         newinstance "frmthings", "things"         activate "things".Exec()         form.dummy = "things"         setformfocus "things"         tab = "things"         activate tab     case "somethings"         newinstance "frmsomethings", "somethings"         activate "somethings".Exec()         form.dummy = "somethings"         setformfocus "somethings"         tab = "somethings"         activate tab     case "otherthings"         newinstance "frmotherthings", "otherthings"         activate "otherthings".Exec()         form.dummy = "otherthings"         setformfocus "otherthings"         tab = "otherthings"         activate tab endselectcase And it works good. The code can open contained forms. But when I have the focus in the new opened form (contained) always I have to press "esc" on keyborad to close the form and get the focus on the main form. Por example: if I need to press an other "Tab" for activate the Trigger "Value Changed" in my tab, I can´t, 'cause I need press in first place the key "Esc" to close it. How can I fix that? How can I lose the focus from the contained form pressing the tab who has the "Selectcase"?   Thanks a lot.

3 Comments

  1. Theo Neeskens said Not clear what your situation is. A form in a Tabex is already very similar to a form in a Form Container. Do the forms that you have in you Tabex (things, somethings and otherthings) each have a Form Container painted on them? And like the previous comment says you code can't be correct. The Value Changed trigger of the TabEx fires when the value has already been changed so you do not need the line: tab = things And you activate the forms twice: First with activate "things".Exec() Again with tab = "things", activate tab Also you do a newinstance every time the user clicks the a tab. That has the consequence that the second time the user clicks the same tab the newinstance will fail. It is better to this in the execute trigger of the main form instead of where your code is now: newinstance "frmthings", "things" newinstance "frmsomethings", "somethings" newinstance "frmotherthings", "otherthings" activate "things".Exec() activate "somethings".Exec() activate "otherthings".Exec() Because the value of the Tabex is automtically changed when the user click a different tab you do not need code in the Value Changed trigger.  

    Thank's Theo Neeskens I use only a form container for the tabex, actually the advices that you gave me are working perfectly!! The Tabex is changing automatically when I click it, but when I it open a new instance of a form my main form loses de focus and i can´t get it back until I close the contained form opened.   Do I need use "Form Loses Focus Trigger" or something?  


    Author: lorenzo.arellano (lorenzo.are@gmail.com)
  2. I don't think the final 'activate tab' statement is necessary, nor is the tab=otherthings (since the selectcase says that tab already = otherthings.) The final activate is probably  returning a negative, meaning that the value changed trigger 'fails', but the setformfocus is moving the focus to your other screen.  Ensure the valuechanged trigger returns 0 where all the code has worked (note that, depending on how you work this, you can reselect this tab and the activate XXXX.exec (and the newinstance for that matter) will both fail, as the component is already activated. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  3. Not clear what your situation is. A form in a Tabex is already very similar to a form in a Form Container. Do the forms that you have in you Tabex (things, somethings and otherthings) each have a Form Container painted on them? And like the previous comment says you code can't be correct. The Value Changed trigger of the TabEx fires when the value has already been changed so you do not need the line: tab = things And you activate the forms twice: First with activate "things".Exec() Again with tab = "things", activate tab Also you do a newinstance every time the user clicks the a tab. That has the consequence that the second time the user clicks the same tab the newinstance will fail. It is better to this in the execute trigger of the main form instead of where your code is now: newinstance "frmthings", "things" newinstance "frmsomethings", "somethings" newinstance "frmotherthings", "otherthings" activate "things".Exec() activate "somethings".Exec() activate "otherthings".Exec() Because the value of the Tabex is automtically changed when the user click a different tab you do not need code in the Value Changed trigger.  


    Author: Theo Neeskens (tneeskens@itblockz.nl)