Jump to content
  • Advertisement
Sign in to follow this  
Strawberry

win 32 api, editbox

This topic is 4841 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

Hay im trying to make a window with an edit box, so far so good, i can use the edit box and all,... but it looks like shit =/, using like SYSTEM font or something realy oldlooking, how do i get a editbox to look like the one u get with the dialog editor in vc++? Here is what i have so far, but it dosnt realy look apealing, if noone can help me soon ill give up on makeing a real window, and make a cute dialog box as i used to do :P, i wanna be able to like change the font and give it a real boarder, is that to much of ask of win32 api? T_T // Create the input fields hChildWnd = CreateWindow ("EDIT", NULL, WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | WS_BORDER, 740, 60, 255, 20, hWnd, (HMENU) IDC_EDT_TITLE, (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), NULL);

Share this post


Link to post
Share on other sites
Advertisement
Ah, thx a lot! =)
Now there is but one(two..) thing(s) left, how do i get the standard sunken down border? =/ all i get is a java like single pixel width black line border =),

And how do i make GROUPBOXes with createwindow =)

Share this post


Link to post
Share on other sites
For the standard (as of Win95) sunken border you need to call CreateWindowEx and use WS_EX_CLIENTEDGE.

Groupboxes are weird as it sounds BUTTONs.
Use CreateWindow with "BUTTON" as class and the BS_GROUPBOX style.

Share this post


Link to post
Share on other sites
Thx alot ;)... Uhmm.. now the last problem,
I need tabstops, im currently reading on msdn about it, but i aint sure if it will help me figure it out :O so anyone got skillz with tabstops? i figured id be using WS_TABSTOP atleast ;)

Share this post


Link to post
Share on other sites
Yep, WS_TABSTOP on the controls you want to reach via the TAB key.
AND also, in your message pump, have a call to IsDialogMessage:


if ( GetMessage( &msg, NULL, 0, 0 ) )
{
if ( !IsDialogMessage( hwndDlg, &msg ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}


The function IsDialogMessage checks if the message is a key press which might change the focus (TAB key) and others (cursor keys to move to another control). If it finds a suitable message it will call TranslateMessage/DispatchMessage internally.

Share this post


Link to post
Share on other sites
Thx that did the trick!
and WS_EX_CLIENTEDGE didnt kind of work =/ it just removed the border =/, and using both that and WS_BORDER didnt work :O, is there anything else i need together with it for it to work? =P

Share this post


Link to post
Share on other sites
Did you use CreateWindowEx?

Should look like this:


hChildWnd = CreateWindowEx( WS_EX_CLIENTEDGE, "EDIT",
NULL,
WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | WS_BORDER,
740, 60,
255, 20,
hWnd,
(HMENU) IDC_EDT_TITLE,
(HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
NULL);


Don't mix the extended styles with the "normal" styles.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!