# StyledTextCtrl not receiving all entered keys

**URL:** <https://www.ruby-forum.com/t/styledtextctrl-not-receiving-all-entered-keys/155653>\
**Category:** wxRuby\
**Created:** [December 15, 2008, 10:32am UTC](https://www.ruby-forum.com/t/styledtextctrl-not-receiving-all-entered-keys/155653 "2008-12-15T10:32:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![robinr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@robinr](https://www.ruby-forum.com/u/robinr)\
**Post date:** [December 15, 2008, 10:32am UTC](https://www.ruby-forum.com/t/styledtextctrl-not-receiving-all-entered-keys/155653/1 "2008-12-15T10:32:10Z")

</div>

Hi,

i am working on a little editor based on the StyledTextCtrl. The  
problem: The keys “wrtzfy.-#+124780” are not being received by the  
control, so there is no output within the control and no events are  
being triggered. I’ve tested this on two different machines running (one  
running XP and the other one running Vista), but these keys do work with  
other controls within the same application. Any idea what might be the  
cause?

Greetings from Hamburg / Germany

- rojaro -

---

<div class="post-metadata">

**Author:** ![robinr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@robinr](https://www.ruby-forum.com/u/robinr)\
**Post date:** [December 16, 2008, 5:36am UTC](https://www.ruby-forum.com/t/styledtextctrl-not-receiving-all-entered-keys/155653/2 "2008-12-16T05:36:02Z")

</div>

Hi

Robin Rogge wrote:

> i am working on a little editor based on the StyledTextCtrl. The  
> problem: The keys “wrtzfy.-#+124780” are not being received by the  
> control, so there is no output within the control and no events are  
> being triggered. I’ve tested this on two different machines running (one  
> running XP and the other one running Vista), but these keys do work with  
> other controls within the same application. Any idea what might be the  
> cause?

That’s strange. I can’t reproduce the error on XP using the wxRuby  
scintilla sample. Could you try running that sample please? If the  
sample problem occurs, then I guess it’s a bug with Vista, otherwise  
there must be something in your app that’s consuming those characters.  
Perhaps an evt\_char handler that is not calling skip on the event?

If this doesn’t help, please send a minimal, runnable, self-contained  
sample that demonstrates the issue.

a

---

<div class="post-metadata">

**Author:** ![robinr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@robinr](https://www.ruby-forum.com/u/robinr)\
**Post date:** [December 16, 2008, 11:21am UTC](https://www.ruby-forum.com/t/styledtextctrl-not-receiving-all-entered-keys/155653/3 "2008-12-16T11:21:14Z")

</div>

Hi Alex,

Alex F. wrote:

> > i am working on a little editor based on the StyledTextCtrl. The  
> > problem: The keys “wrtzfy.-#+124780” are not being received by the  
> > control, so there is no output within the control and no events are  
> > being triggered. I’ve tested this on two different machines running (one  
> > running XP and the other one running Vista), but these keys do work with  
> > other controls within the same application. Any idea what might be the  
> > cause?
> 
> That’s strange. I can’t reproduce the error on XP using the wxRuby  
> scintilla sample. Could you try running that sample please? If the  
> sample problem occurs, then I guess it’s a bug with Vista, otherwise  
> there must be something in your app that’s consuming those characters.  
> Perhaps an evt\_char handler that is not calling skip on the event?

Thanks for your response. I actually never saw this demo before and it  
works perfectly. So, looking at it, i see the main difference between my  
code and the demo code is that i use an extended StyledTextCtrl, while  
the demo uses a direct instance of StyledTextCtrl. For testing, i  
trimmed my extended class as far as possible until the following code  
remained, while the problem still remained:

class EditorPage \< Wx::StyledTextCtrl  
end

So the demo uses

@sci = Wx::StyledTextControl.new(self)

while i use

@sci = EditorPage.new(self)

Note that this problem occurs on both, Windows XP and Vista.

Greetings from Hamburg / Germany

- rojaro -

---

<div class="post-metadata">

**Author:** ![robinr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@robinr](https://www.ruby-forum.com/u/robinr)\
**Post date:** [December 16, 2008, 1:26pm UTC](https://www.ruby-forum.com/t/styledtextctrl-not-receiving-all-entered-keys/155653/4 "2008-12-16T13:26:36Z")

</div>

Robin Rogge wrote:

> So the demo uses
> 
> @sci = Wx::StyledTextControl.new(self)
> 
> while i use
> 
> @sci = EditorPage.new(self)

I don’t believe there is a problem with subclasses of StyledTextCtrl. If  
you put your subclass in the wxRuby demo it still works fine, and I’ve  
used complex subclasses of STC in real code without difficulty.

So there is something else wrong in your program. Happy to try out a  
minimal runnable sample that demonstrates the issue - you may find that  
selectively removing elements from the frame may identify the source of  
the difficulty. My guess would be that some other widget (eg a Frame) or  
the App is being told to trap and not pass them on.

alex

---

<div class="post-metadata">

**Author:** ![robinr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@robinr](https://www.ruby-forum.com/u/robinr)\
**Post date:** [December 16, 2008, 2:52pm UTC](https://www.ruby-forum.com/t/styledtextctrl-not-receiving-all-entered-keys/155653/5 "2008-12-16T14:52:29Z")

</div>

Hi Alex,

Alex F. wrote:

> I don’t believe there is a problem with subclasses of StyledTextCtrl. If  
> you put your subclass in the wxRuby demo it still works fine, and I’ve  
> used complex subclasses of STC in real code without difficulty.
> 
> So there is something else wrong in your program. Happy to try out a  
> minimal runnable sample that demonstrates the issue - you may find that  
> selectively removing elements from the frame may identify the source of  
> the difficulty. My guess would be that some other widget (eg a Frame) or  
> the App is being told to trap and not pass them on.

Damn … it just had to be something really stupid. The “CTRL” in front  
of some shortcuts for the dynamically created menu items in the menubar  
was missing. I just removed them from the item generating method for now  
and viola, StyledTextCtrl works. Thanks for your help 🙂

Greetings from Hamburg / Germany

- rojaro -
