Hi!
Is there a way to make a Dialog "Edit" field non editable or read only?
Dialog#1 have an "Edit" field which excepts input.
Dialog#2 have the same field but the "Edit" contents should be shown with the input entered in Dialog#1
I have all this working but I just dont want the user to be confused and trying to edit the field in Dialog#2
I have MS 7.4.
Thanks!
/tomas
Display variable text in Dialog - and "read only"
Moderators: JRL, Dorian (MJT support)
-
- Pro Scripter
- Posts: 149
- Joined: Tue Mar 23, 2004 9:11 pm
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Yes, but to do this you would need to 1) get the handle of the edit field, then 2) use the Win32 EnableWindow function. Here's an example:
The messy part is getting the handles of the objects. That's why a forthcoming version of Macro Scheduler will give you variables for the object handles as soon as the dialog is created. Then you can simply use EnableWindow and not have to do all the FindWindow stuff to locate the handles.
Code: Select all
Dialog>Dialog1
Caption=My Dialog
Width=291
Height=164
Top=199
Left=63
Edit=msEdit1,72,32,121,msEdit1
Edit=msEdit2,72,64,121,msEdit2
EndDialog>Dialog1
//initialisation
Show>Dialog1
//get handle of dialog
LibFunc>user32,FindWindowA,dlgHwnd,TForm,My Dialog
//get handle of msEdit2 edit - we use the edit text, so do this when
//you first show the dialog, before setting the value of the edit
LibFunc>User32,FindWindowExA,edthwnd,dlgHwnd,0,TEdit,msEdit2
//now we can do what we want to the dialog ..
//disable the edit and open modal
CloseDialog>Dialog1
LibFunc>User32,EnableWindow,res,edthwnd,0
Show>Dialog1,r
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?