flat assembler
Message board for the users of flat assembler.

Index > Windows > Edit item properties

Author
Thread Post new topic Reply to topic
Doug Herr



Joined: 19 Sep 2010
Posts: 14
Location: Sacramento
Doug Herr 12 Mar 2014, 17:26
Apologies if this is an elementary question, Windows isn't my first or favorite language. I have an edit item in my resource list which is initially visible

dialogitem 'EDIT','?', MC_PRODUCTTYPE, EDITBOXX,TYPY,TEXTEDITFIELDWIDTH,12, WS_VISIBLE or WS_BORDER or WS_TABSTOP, 0

and depending on user input I want to make this edit input invisible. How do I do this?

_________________
Doug Herr
Sacramento
http://www.wildlightphoto.com
Post 12 Mar 2014, 17:26
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1635
Location: Toronto, Canada
AsmGuru62 12 Mar 2014, 18:21
You need to respond to EN_CHANGE notification in your dialog box procedure.
I do not see however, how will you make it back to visible?
Because once it is invisible - you cannot edit it.
Post 12 Mar 2014, 18:21
View user's profile Send private message Send e-mail Reply with quote
Doug Herr



Joined: 19 Sep 2010
Posts: 14
Location: Sacramento
Doug Herr 12 Mar 2014, 18:26
A separate checkbox determines whether the edit item is needed or not,

i.e., checkbox checked -> edit item invisible and editing not necessary
checkbox not checked -> edit item visible & editable
Post 12 Mar 2014, 18:26
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
Doug Herr



Joined: 19 Sep 2010
Posts: 14
Location: Sacramento
Doug Herr 12 Mar 2014, 20:21
I'm guessing there's a message I can send (SendMessage) that will make the item visible or invisible, but what message and with what parameters? A few hours searching MSDN did nothing but cure insomnia.
Post 12 Mar 2014, 20:21
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 12 Mar 2014, 20:38
Doug Herr,

Try setting window style of that control (beware of making current control invisible). Disabling works the same way.
Post 12 Mar 2014, 20:38
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 12 Mar 2014, 20:58
Code:
invoke ShowWindow, [.win_handle], SW_SHOWNORMAL
invoke ShowWindow, [.win_handle], SW_HIDE

; You can find the dialog box control handle by calling:

invoke GetDlgItem, [.dialog_handle], .control_ID    
Post 12 Mar 2014, 20:58
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Doug Herr



Joined: 19 Sep 2010
Posts: 14
Location: Sacramento
Doug Herr 12 Mar 2014, 21:08
JohnFound wrote:
Code:
invoke ShowWindow, [.win_handle], SW_SHOWNORMAL
invoke ShowWindow, [.win_handle], SW_HIDE

; You can find the dialog box control handle by calling:

invoke GetDlgItem, [.dialog_handle], .control_ID    


Nope, the edit item and the checkbox are in the same dialog box

baldr wrote:
Doug Herr,

Try setting window style of that control (beware of making current control invisible). Disabling works the same way.


Can you show me an example?

Or do I need to destroy the entire dialog box & re-display with or without the edit item?

_________________
Doug Herr
Sacramento
http://www.wildlightphoto.com
Post 12 Mar 2014, 21:08
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 12 Mar 2014, 21:30
1. Process the WM_COMMAND message of the dialog box. You will get one for every click on the check box. Identify the check box by the control ID, passed in the low word of .wparam.

2. If the click is on the check box, read the check box state by sending message BM_GETCHECK. Invert it and use BM_SETCHECK to set the new state of the checkbox.

3. Get the edit box handle by "invoke GetDlgItem, [.dlg], idEdit" - the result handle is in EAX.

4. If the checkbox is checked, call: "invoke ShowWindow, eax, SW_SHOWNORMAL". If not: "invoke ShowWindow, eax, SW_HIDE".

5. that is all...

Similar code, used in one of my programs (it enables/disables the edit control insted of hiding/showing, but the idea should be clear):
Code:
.wm_command:
        cmp     word [.wparam], idAutoHideCheck   ; the checkbox ID is idAutoHideCheck
        jne     .ondefault

        cmp     word [.wparam+2], BN_CLICKED  ; the checkbox has been clicked.
        jne     .ondefault

        invoke  SendDlgItemMessageA, [.hwnd], idAutoHideCheck, BM_GETCHECK, 0, 0
        mov     ebx, eax
        xor     ebx, 1
        invoke  SendDlgItemMessageA, [.hwnd], idAutoHideCheck, BM_SETCHECK, ebx, 0

        invoke  GetDlgItem, [.hwnd], idAutoHideTime   ; idAutoHideTime is the ID of the edit control.
        invoke  EnableWindow, eax, ebx    
Post 12 Mar 2014, 21:30
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Doug Herr



Joined: 19 Sep 2010
Posts: 14
Location: Sacramento
Doug Herr 12 Mar 2014, 21:42
Thanks JohnFound, I'll give that a try.

EDIT: I got it working & it's just what I wanted, thanks again.
Post 12 Mar 2014, 21:42
View user's profile Send private message Send e-mail Visit poster's website 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.