← Back to team overview

kicad-developers team mailing list archive

Re: Re: TODO.txt item L1)

 

Dick Hollenbeck wrote:
> jeanpierre_charras wrote:
>> --- In kicad-devel@xxxxxxxxxxxxxxx, Dick Hollenbeck <dick@...> wrote:
>> 
>>> Can somebody spend some time and do some research on this L1) problem 
>>> for me please?
>>>
>>> See TODO.txt.
>>>
>>> 
>> Dick,
>> I believe wxWidget has no problem:
>> the bug is in passOnFocus()
>> passOnFocus() assume this is the parent that had the focus:
>>
>>
>> void LAYER_WIDGET::passOnFocus()
>> {
>> wxWindow* parent = GetParent();
>> parent->SetFocus();
>> }
>>
>> This is false, and the focus is not set to the right window.
>>
>>
>> Here is a change in layer_widget.cpp that fixes this problem:
>>
>> 1)
>> parent->SetFocus();
>> changed to
>> // parent->SetFocus();
>>
>> 2) Line 630
>> wxWindow* w = FindFocus();
>> getLayerComp( newNdx + 1 /* 1 is column */ )->SetFocus();
>> if ( w ) w->SetFocus();
>>
>>
>> This is an ugly hack, that needs to be more tested, but it works.
>>
>>
>> Jean-Pierre Charras
>> 
> Jean-Pierre,
> 
> Thanks for your efforts here. 
> 
> However, I do not think we are working towards the same goal, unless I 
> misunderstand your solution.
> 
> My goal is to give the focus back to the APP, I don't want the focus, 
> because the focus is where keyboard entry goes to. We have hotkeys in 
> PCBNEW, and when the LAYER_WIDGET has the focus, then it gets the keys 
> and then the hotkeys do not work. We want to return the focus back to 
> the topmost frame so it can handle the hotkeys again.

The hot key implementation is defined in WinEDA_DrawPanel::OnKeyEvent()
so the DrawPanel would need the focus not the main frame window in order
to restore normal hot key functionality. wxWidgets events get passed up
the stack from child to parent unless Skip() is called in the event
handler. It's crucial to remember this relationship to get the keyboard
input directed to the correct window. Otherwise, the user will be
forced to click on the window to move the focus which typically is not
obvious to the user. It may make sense to force the focus to the draw
panel any time the main window receives the focus to prevent this behavior.

Wayne

> Is yours a solution to this problem or to some other problem? It looks 
> like you are setting focus on a LAYER_WIDGET child, and I don't see how 
> this could possibly enable HOT KEYS that are handled back up in the 
> Pcb_Frame.
> 
> 
> Thanks,
> 
> Dick
> 
> 
> 
> ------------------------------------
> 
> Yahoo! Groups Links
> 
> 
> 
>

 




Follow ups

References