win 32 api, editbox

Started by
7 comments, last by Strawberry 18 years, 11 months ago
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);
-------------------------When the strawberrys hit the earth..-------------------------
Advertisement
I would try sending the edit WM_SETFONT using GetStockObject(DEFAULT_GUI_FONT) or GetStockObject(SYSTEM_FONT).
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 =)
-------------------------When the strawberrys hit the earth..-------------------------
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.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

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 ;)
-------------------------When the strawberrys hit the earth..-------------------------
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.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

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
-------------------------When the strawberrys hit the earth..-------------------------
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.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Gaaaahhhhhh stupid me =P
Thx a bunch man! ;) you are my new hero!
-------------------------When the strawberrys hit the earth..-------------------------

This topic is closed to new replies.

Advertisement