Sign in to follow this  

EditBox Questions..

This topic is 3590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Now thats a good question short Answer no.. Long answer yes.

Basicaly for edit boxs that only way you can realyl get an idea of what the user is inputing is if you subclass the control witch more or less means that you are writing the EditBoxs Proc.

Now i do not totaly remmber if with subclassing if you complty replace the Windows Functionality when you Sub class or if you just overide the Parts you want too i can not totaly remmber and i don't think i ever got it to work right but more or less its the same deal.

So needless to say take a look into subclassing that may or may not help but its a start.

Reagards Jouei.

Share this post


Link to post
Share on other sites
I tryed something like this but dunno if going in the right direction:

CreateWindow( "Edit", NULL, style, 0,0, 30, 30, hWndParent, (WINPROC)EditWinProc, hInstance, NULL );

Using the EditWinProc for that window like if were a Dlg window.
My mistake =P (WINPROC) and (HWND) ^^; i think i have go back to DirectInput =P

[Edited by - Xhadow on February 17, 2008 6:24:39 PM]

Share this post


Link to post
Share on other sites
Yeah see the problem with that is that Adding the bit of code itn eh menu spot i assume is something you learned from buttons :p

It just sends a flag saying somethings been clicked on as far as i know.
Basicaly in order to do what you want is not as easy as it sounds.

You need to create the control like you normaly do and then switchits proc with one you created just like the main windows one. Useing SetWindowLong to cast the proc to the control and in that proc you have to handel everything frm geting the users input from the keyboards to actualy drawing the window....


So basicaly you have to do your own edit box.

I am not aware of any other way to get the input you want if i did id let you know.

Regards Jouei.

Share this post


Link to post
Share on other sites
I saw a DlgWindow that uses another MsgProc, really there is no way to use something like this for editbox?

LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_DESTROY:
PostQuitMessage( 0 );
return 0;
case WM_KEYDOWN:
// check here
break;
default:
break;
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}

Share this post


Link to post
Share on other sites
Well the thing you have to remmber is that Every control is a window of its own and when you use Common controsl like EditBoxs that have there own Msg procs that recive and dela with the messages hance like user input the parent window Only recives messages that affect it like needing to redraw itself and so forth.

So as far as im aware and i have tryed no :p
In this case there is just no simple answer if bu some freak reason it was jsut the on control in the whole program lol you could just check to see if it was no longer in focus most cases there the enter would ov been pressed.

Besides that i realyl don't know iv just been told before that you have to Sbuclass the control iv Subclassed controls before but in allreality all i ended up with was a window of a common controlt hat i replaced its whole WinProc and that was not my desired result.

Anywho i just don't have a better answer for you sorry.

regards Jouei.

Share this post


Link to post
Share on other sites
@Xhadow: You've got it - the way to know when the user presses something is to subclass the control. I strongly recommend you read this to learn how. You basically just check for the WM_KEYDOWN message and then do whatever you need to do when the key code is VK_F1 or whatever, and pass all messages to the original message processor. Good luck.

Share this post


Link to post
Share on other sites
Thanks for that answer i was pritty sure subclassing would required but with prevous experinces iv had it did not work out right. But hopefuly with that reource they can get it working right.

Regards Jouei.

Share this post


Link to post
Share on other sites

This topic is 3590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this