I must to press spacebar twice to write some code in xCode - c++

I just started to use xCode to code C++ recently and found this issue very annoying.
Whenever I start to code something, xCode underlined that and I have to press the spacebar once just to make it disappears and twice for the space letter.
Example:
Sorry for my English, I'm new at this, please help.

Whenever I start to code something, xCode underlined that and I have to press the spacebar once just to make it disappears and twice for the space letter.
You're using a keyboard input method like Telex or Simple Telex, right? With either of those methods enabled I get behavior you describe even in Safari. If you switch to a standard US keyboard, for example, you'll find that the behavior goes away in Xcode and everywhere else.

i found a solution, just change the keyboard layout and it's perfect

Related

Why is my button firing twice?

I have a CButton as part of a CDialog screen. Everything works fine, but after I reinitialize a hardware device, when I click anywhere on the screen (even outside the dialog) the event for the CButton in question fires. I've run through the code in debugger mode, and the app literally thinks the button in question is being pressed. Thing is, its NOT being pressed. I've experimented with clearing the message pump, but that didn't seem to help. If you need code, let me know and I'll see what I can drum up without giving away how our app works. I get the feeling this is an edge case that others have run into and know how to solve without code.
Thanks in advance!

Automatic Code completion in Eclipse 8.4?

I recently installed Eclipse Luna(for win7) for developing C++ programs. The problem is the code completion only shows suggestions when I press Ctrl + Space button. I searched on the internet, but the only solution I was able to find is for old Eclipse(Java) version 3.4 or something. In that you have some text feilds in which you can enter the characters for auto-completion. But in 8.4 there are no such text-fields. Do they have a plugin for this? Please Help me
Yes they've changed the behavior a bit. The auto completion list pops up at entering ., -> or ::, and as you mentioned with CTRL + Space
If the list popped up, press TAB once to get inside the popup selection list, and go up down with the arrow keys. Press enter to select one.
If the entered symbol is specified enough, to select a proposal, hitting Space after the dialog popped up, will autocomplete though.

How can I hide the mouse cursor?

I wanna ask if someone can provide me a c++ code in which I can hide/show the pointer of the mouse when pressing a specific key..
I found several codes written for only TURBO C++, none of which can be compiled and run using dev c++ or even visual c++..
I tried running the codes I found in Dev C++ but I only get lots of errors and incompatibilities..
I also found several articles that says I can use the function ShowCursor but it just wouldn't work..
In fact hiding the cursor can turn out to be quite a task, depending on what you want to achive. If you're programming a GUI-application using the WinAPI it is pretty easy.
Just calling ShowCursor(false); once might turn out not to work in some cases though, since the ShowCursor function only "sets an internal display counter". The cursor is displayed until this counter is smaller than 0 (see msdn on it). You could try something like this:
while(ShowCursor(false)>=0);
to ensure the counter gets below 0.
This will however only hide the cursor inside your applications window, if you're using newer Windows versions like Windows 7. Hiding the cursor all over the system could turn out to be a lot more difficult.
If you are programming a console application ShowCursor won't show any effect as far as I've tested it. Using the following code:
while(ShowCursor(false)>=0);
std::cout<<ShowCursor(false)<<std::endl;
std::cout<<ShowCursor(true)<<std::endl;
we can see, that the counter definitely is below 0, but still the cursor is displayed. I haven't come up with a solution to this so far.
If you look at the documentation for the SetCursor function, setting the cursor to a NULL handle (e.g SetCursor(NULL)) will remove the cursor from the screen.

What function is called when Alt-Enter is pressed?

I have a game app that has the ability to go fullscreen and back to windowed when Alt-Enter is pressed. However, when it goes fullscreen, I get the following warning from DirectX:
DXGI Warning: IDXGISwapChain::Present: Fullscreen presentation inefficiencies incurred due to application not using IDXGISwapChain::ResizeBuffers appropriately, specifying a DXGI_MODE_DESC not available in IDXGIOutput::GetDisplayModeList, or not using DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH.
I've already ruled out the second two possibilities through testing, so I know the only reasons left for the warning to pop up are either IDXGISwapChain::ResizeBuffers isn't being used right, or Windows is just bugged. Since I can't debug the 2nd possibility, I'm sticking with the ResizeBuffers problem. To debug this, I want to look at what happens when Alt-Enter is pressed going from windowed to fullscreen. However, the app does not seem to be calling my ResizeDXGIBuffers method; in fact, it seems that Alt-Enter is embedded into windows or DirectX somewhere, and I don't know how to find the chain of function calls that go off when it is pressed. EDIT: When my method is put in the WM_ACTIVATEAPP handler, it is called, but this is not what i meant. If i take it out of that message handler, the window STILL goes to fullscreen, even though I am not calling any functions to make the window fullscreen myself. So Alt+Enter must be automatically calling some internal function to do this.
So that is my question: Does anyone know what function is called by windows and/or DirectX 11 when Alt-Enter is pressed?
EDIT: As the tags for this question say, I am using DirectX 11 on a Windows machine. Specifically, Windows 7 64-bit.
EDIT 2: I now completely eat the Alt+Enter keystroke and manually store the state of Alt+Enter being pressed so that I know for certain only my code is being called. The warning I spoke of above persists, however. I am following the MSDN best practices as well, so I don't know where to go from here.
Try handling the WM_ACTIVATEAPP message.
I do not know which framework you use to create your windows, so I can't tell how to concretely handle this message.
After looking at the MSDN best practices page and re-working my code to reflect all of the practices described, the warning has disappeared. I hope this helps anyone else that has the same problem.
Also, thanks to Hans Passant for the link. I already fixed it by the time you posted it, but thanks anyways.

MFC Edit Box - Multiple Characters per Keystroke?

I am trying to create a simple dialog in MFC using Visual C++. My problem is that when I get the dialog on the screen and try to type in an Edit Box field, if I type the letter 'a' once, it appears in the edit box as 'aaaaaaaaaaa' (that's 12 a's). Furthermore, if I try to navigate around in the box using the arrow keys, the carat moves 12 characters at a time.
It's not just a display error, as the output from the editbox is still "aaaaaaaaaaaa".
I'd post code, but there's really none to post. I added the edit box using the Toolbox in Visual Studio and assigned a variable to it in my class so this isn't any sort of special edit box.
If anyone has any thoughts as to what might be happening it would be greatly appreciated. Unfortunately, I don't know where to begin.
Thank as always.
To debug this, add PreTranslateMessage function to your dialog, and see exactly how many times the keydown is being processed.
BOOL DialogName::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
// TODO: see what is going on here
return TRUE; //do not dispatch this message, so keydown will have no effect
}
return CDialog::PreTranslateMessage(pMsg);
}
Are you capturing any events such as WM_KEYUP in your PreTranslateMessage() function or anywhere else in your app ?
If you have overridden the default handling for keyboard events, it might cause the symptoms you are seeing.
For some reason this brings back vague memories of early struggles with MFC. Have you looked for mutual recursion at all? I was forever doing something in one bit of the app that sent a message (unbeknown to me) that was picked up by another method that called the first method...
My guess is it's one of those smack the forehead ones; it gives me this nagging sense of deja vu that I can't make concrete.
If it's mutual recursion you should be able to see it in the call stack, if you can find the right place for a break point.
Is this happening for a fresh project, or can you recreate this problem in a fresh project?
It'll help discern whether it's something you've done in your code, or your install.
I installed service pack 2 in my WinXp 64 OS and the problem get solved for me :)