Browse doesn"t get focus

Post Reply
User avatar
Raymond Fischbach
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium
Contact:

Browse doesn"t get focus

Post by Raymond Fischbach »

Hello all,

I open a window that displays a browse.
I use the up and down arrows to skip the records in the browse, the selected record being white on blue while all other records are black on white.
There is a button (or I detect a keyboard key) that calls a sub function to do some data entry.
When I call this function, the selected record becomes white on grey (probably meaning that it is disabled).
When I come back from the sub function, the record stays disabled (white on grey).
If I use the scroll bar, there is no problem, the focus goes to the next (previous) record and it is enabled (white on blue).

The problem is when I want to skip with the arrow keys. I need to pess this key a few but variable number of times before it seems recognized.

How can I change the program so that the record is enabled when returning from the sub function ?

The following code is an extract of a more complex routine:

Code: Select all

   iif(nKey == Asc("3"),;
             (nEss := oF10b:ESSENCE,;
              iif (cMethode == "M" .AND.;
                   (nEss == 41 .OR. nEss == 42 .OR. nEss == 150 .OR. nEss == 151),;
                   cRet := "P",cRet := cMethode),;
              DetAddSel(aFichiers,Str(nEss),Str(oF10b:SOUS_CODE),cRet,"edit"),;
              oBrw:refresh(),;
              MsgInfo("*"),;
              oBrw:SetFocus()),;
 
Remark that MsgInfo("*") is executed but the browse doesn't seem to receive the focus.

Regards,
Raymond
Raymond Fischbach
www.mouches.org
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Browse doesn"t get focus

Post by Antonio Linares »

Raymond,

Try not to call oBrw:refresh() and see if that makes a difference, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Raymond Fischbach
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium
Contact:

Re: Browse doesn"t get focus

Post by Raymond Fischbach »

Hi Antonio,

I have an answer, a workaround and maybe an explanation.

Explanation:
It seems that the function DetAddSel() is executed in another thread. Then the function is called and immediately the following statements are executed. Then the browse is active again, the new window is also started but it is covered by the browse.

Workarounds:
The one I have used is to add oBrw as a parameter to DetAddSel() and to move the refresh in that function just before leaving:

Code: Select all

oBrw:refresh()
oBrw:SetFocus()
 
Another possibility (I think but not tested) is to use pass oWnd as a parameter to DetAddSel and to use the clause "OF oWnd" when creating the new window. I suppose that then this new window will be modal.

Concerning your suggestion, I tried all possibilities but the record always remains disabled. This is not a problem if you use the touchscreen because as soon as you touch the screen, the browse regains the focus but the users of this program must use the keyboard.

Regards,
Raymond
Raymond Fischbach
www.mouches.org
Post Reply