flat assembler
Message board for the users of flat assembler.

Index > Windows > Some questions 'bout changing window elements properties

Author
Thread Post new topic Reply to topic
Tyler Durden



Joined: 24 Feb 2004
Posts: 50
Tyler Durden 20 Nov 2005, 08:18
Hi, I wrote tinny "noter" Smile too greet guys rooted by me Smile It's also greets my sucky inet provider ICN Smile But there're some things i want to change but don't know how Sad

1. How to change background color and font in "edit" element ?
2. How to make this window to be "always on top" ?
3. How to make "edit" element unselectable ?
4. How to to select which element is "focused" when proggy starts ?

Get all sources and exe here: http://www.tylerdurden.net.ru/icnsuxx.zip

_________________
Image
Post 20 Nov 2005, 08:18
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 20 Nov 2005, 08:50
1. Create font and send WM_SETFONT message to Edit Control.
2. Create window with WS_EX_TOPMOST extended style (you have to call CreateWindowEx) or (after window is created) you can togglw "always on top" style by calling SetWindowPos with HWND_TOPMOST parameter (look at win32.hlp for details).
3. Do you mean that user can't edit text in Edit (then just create it with ES_READONLY style)? Or that he can't select it with TAB key (in this case create it without WS_TABSTOP style).
4. call SetFocus with handle of element to be focused.

All of this APIs, messages and styles are well described in both win32.hlp and MSDN.
Post 20 Nov 2005, 08:50
View user's profile Send private message Visit poster's website Reply with quote
Tyler Durden



Joined: 24 Feb 2004
Posts: 50
Tyler Durden 20 Nov 2005, 10:38
Hi, sorry of the noobism of mine Smile but
1. How to send message to control ? I try
invoke PostMessage,[hwnddlg],WM_SETFONT,?,? <- where to put font handler and element id ?
2. Ok, thanks
3. Mine edit control allready ES_READONLY, i need that it can not be selected (i mean selection of the text)
4. Hm... How to set focus on element with that ?
HWND SetFocus(
HWND hWnd // handle of window to receive focus
);

P.S. Btw, forgot to ask, where is "return" macro ? (i put "pop ebp" instead of it in the code, 'couse new fasm don't know what is "return")

_________________
Image
Post 20 Nov 2005, 10:38
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 20 Nov 2005, 11:37
OK, now I understand that you created your dialog using CreateDialog or simiar API and you have to communicate with dialog item using their IDs.
So:

1.
Code:
invoke SendDlgItemMessage, [hwnddlg],ITEM_ID,WM_SETFONT,[hfont],TRUE    


or

Code:
invoke GetDlgItem, [hwnddlg],ITEM_ID
invoke SendMessage, eax,WM_SETFONT,[hFont],TRUE    


3. Proably you can't achive this with standard edit control, you have to subclass it (may be difficult) or handle EN_SELCHANGE notification (easier, but may not be what you actually want).

4.
Code:
invoke GetDlgItem, [hwnddlg],ITEM_ID
invoke SetFocus, eax    
Post 20 Nov 2005, 11:37
View user's profile Send private message Visit poster's website Reply with quote
Tyler Durden



Joined: 24 Feb 2004
Posts: 50
Tyler Durden 20 Nov 2005, 12:32
Oh, thanks very much Wink The last questions, in which way control messages arrive ? I mean, which event i mus handle for them ? WM_NOTIFY ? Or they arrive as-is (e.g. EM_SETSEL) ?

_________________
Image
Post 20 Nov 2005, 12:32
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 20 Nov 2005, 12:54
It is WM_NOTIFY message.
But, I looked at win32.hlp again, and it seems that EN_SELCHANGE applies only to RichEdit controls, so you can't use it with standard Edit. Anyway why do you need edit box with text that can't be selected? You can use static text instead.
Post 20 Nov 2005, 12:54
View user's profile Send private message Visit poster's website Reply with quote
Tyler Durden



Joined: 24 Feb 2004
Posts: 50
Tyler Durden 20 Nov 2005, 13:05
Hm... Can't still get it 2 things ('ve tried almost all):
1. How to set color for edit control
2. How to kill focus from the button
Sad

_________________
Image
Post 20 Nov 2005, 13:05
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend 20 Nov 2005, 21:23
1 - Capture the WM_CTLCOLOREDIT message and return handle of brush with given color, eg.
Code:
wm_ctlcoloredit:
        push    00FF0000h ; red
        call    CreateSolidBrush
        ret    

2 - SetFocus on something else Smile
Post 20 Nov 2005, 21:23
View user's profile Send private message Visit poster's website Reply with quote
Tyler Durden



Joined: 24 Feb 2004
Posts: 50
Tyler Durden 21 Nov 2005, 14:55
Tried this - doesn't work Smile How to handle it's message ? Just like normal or as a part of WM_NOTIFY ?

_________________
Image
Post 21 Nov 2005, 14:55
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 21 Nov 2005, 15:14
it must be working Wink
but you have to change 'call' to 'invoke' - CreateSolidBrush is an API call.
It is normal message, not send via WM_NOTIFY.
Post 21 Nov 2005, 15:14
View user's profile Send private message Visit poster's website Reply with quote
Tyler Durden



Joined: 24 Feb 2004
Posts: 50
Tyler Durden 21 Nov 2005, 17:09
Here is the new code, all done as you said, but still doesn't work Sad

_________________
Image
Post 21 Nov 2005, 17:09
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 21 Nov 2005, 17:52
Checked it, and noticed that readonly edit controls don't send WM_CTLCOLOREDIT message, and are always grayed. Seems that subclassing is an only option Confused
BTW funny program Smile
Post 21 Nov 2005, 17:52
View user's profile Send private message Visit poster's website Reply with quote
Tyler Durden



Joined: 24 Feb 2004
Posts: 50
Tyler Durden 21 Nov 2005, 19:54
Ok, thanks for explaining Smile

_________________
Image
Post 21 Nov 2005, 19:54
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.