[Gambas-user] setfocus eats way too much time

Jean-Yves F. Barbier 12ukwn at ...626...
Sat Aug 15 15:53:23 CEST 2009


Doriano Blengino a écrit :
> Jean-Yves F. Barbier ha scritto:
>> Jean-Yves F. Barbier a écrit :
>>   
>>> Hi list,
>>>
>>> I've got a popup that is a small frame containing a TextArea & 2 buttons.
>>>
>>> In order to do things right, I've got a default text into TextArea; but to
>>> make sure typing will fill the TextArea, I must do 2 things: 
>>> TextArea1.SelectAll()
>>> TextArea1.SetFocus()
>>>
>>> however, SetFocus() introduce a waiting time up to 1.5 seconds before frame shows!
>>>     
>> This only happen the first time: next invocations don't have this delay
>>
>>   
> May be because the first time the whole window is invisible, and the 
> following times is not?

I don't think so, here's the process: 
Lanch open FMain that wait for input,
btn Ok opens a 2nd window that 1st seek a DB to recover languages, procedure names,
  schemas & user names,
I left-click on an item and choose an action in popup,
The small frame that input data for choosen action takes ~1.3sec to show @ 1st 
  (further uses are instantenous!)

A timer is runnig on the 2nd Form to drive the selection bar of popup (25ms).

Code is quite simple
without:
  blah blah process
  frm_Group.Visible = TRUE   ' Frame that contains next textbox
  txb_GroupName.SelectAll()  ' Select all default text in input zone
  
with:
  blah blah process
  frm_Group.Visible = TRUE
  txb_GroupName.SelectAll()
  txb_GroupName.SetFocus()   ' Aaarghhh

For ergonomy I must do that, otherwise the focus isn't on text at opening

> You could also set up a timer (a few milliseconds) and posticipate the 
> setfocus.

I don't think so because the procedure isn't that long and that complex, so if
I setup a timer, it must be in another place than this procedure; this is the
beginning of a future whole mess.

JY

-- 
You can no more win a war than you can win an earthquake.
		-- Jeannette Rankin




More information about the User mailing list