Home » U++ Library support » LineEdit, EditFields, DocEdit » EditField & K_ENTER example (?)
EditField & K_ENTER example (?) [message #19168] |
Sun, 16 November 2008 15:58  |
sapiency
Messages: 56 Registered: September 2008
|
Member |
|
|
Hi,
attached you can find a little example using overloading of Key
with an EditField.
Is this consistent with common using in upp?
But there is still one point which doesn't work as I want. How can I remove the Focus from the editfield? it should to be shown as you see it when the gui is startet, with focus on no element or the focus should be moved to the next element. In this case you see the difference because it is aligned right in the code.
regards
reinhard
|
|
|
Re: EditField & K_ENTER example (?) [message #19261 is a reply to message #19168] |
Sun, 23 November 2008 18:43   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
sapiency wrote on Sun, 16 November 2008 09:58 | Hi,
attached you can find a little example using overloading of Key
with an EditField.
Is this consistent with common using in upp?
But there is still one point which doesn't work as I want. How can I remove the Focus from the editfield? it should to be shown as you see it when the gui is startet, with focus on no element or the focus should be moved to the next element. In this case you see the difference because it is aligned right in the code.
regards
reinhard
|
It is ok.
(this part is a little bit crazy:
std::stringstream ssStream(~tmp);
ssStream >> _count;
_edit.SetData(Sprintf("%d",_count));
- using EditInt would be much easier IMO).
You cannot really 'remove' focus, but you can set it to something else.
There is also one more complicated aspect - TopWindow remembers that last child with focus before it was deactivated - and it is independent from being "open" (otherwise, only "open" widgets can have focus). When it reactivates, it restores focucs to that widget.
You can affect it by calling TopWindow::ActiveFocus(ctrl) - that is practically similar to calling ctrl.SetFocus(), but can be called at any time. When TopWindow gets activated, w will have focus (if it is active, it is same as SetFocus).
Mirek
[Updated on: Sun, 23 November 2008 18:44] Report message to a moderator
|
|
|
Re: EditField & K_ENTER example (?) [message #19272 is a reply to message #19261] |
Sun, 23 November 2008 22:01  |
sapiency
Messages: 56 Registered: September 2008
|
Member |
|
|
luzr wrote on Sun, 23 November 2008 18:43 |
(this part is a little bit crazy:
std::stringstream ssStream(~tmp);
ssStream >> _count;
_edit.SetData(Sprintf("%d",_count));
- using EditInt would be much easier IMO).
|
you are right.
luzr wrote on Sun, 23 November 2008 18:43 |
You cannot really 'remove' focus, but you can set it to something else.
There is also one more complicated aspect - TopWindow remembers that last child with focus before it was deactivated - and it is independent from being "open" (otherwise, only "open" widgets can have focus). When it reactivates, it restores focucs to that widget.
You can affect it by calling TopWindow::ActiveFocus(ctrl) - that is practically similar to calling ctrl.SetFocus(), but can be called at any time. When TopWindow gets activated, w will have focus (if it is active, it is same as SetFocus).
Mirek
|
ok ... I'm learning more and more . I solved my problem by moving Focus to the parent. In my case just SetFocus().
regards
Reinhard
|
|
|
Goto Forum:
Current Time: Fri Apr 25 21:29:28 CEST 2025
Total time taken to generate the page: 0.00825 seconds
|