inactive part of a dialog

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
CatBreath
Junior Coder
Posts: 32
Joined: Fri Jul 08, 2005 6:12 pm

inactive part of a dialog

Post by CatBreath » Sat Jul 30, 2005 10:45 am

I want to do something that looks like this:
Image

When the box is checked i want the editline to be grayish and in the background and when its not i want ti to be available.

Is therea way of doing that in ms?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Aug 01, 2005 12:14 pm

Hi,

Yes, you can use the Windows API to enable/disable an object. Here's a simple example which shows how to enable/disable an edit control. Just run the script and hit the button to enable or disable the edit control:

Dialog>Dialog1
Caption=Test Dialog
Top=176
Width=279
Left=259
Height=118
Label=msLabel1,24,24
Edit=msEdit1,24,40,121,msEdit1
Button=Disable Edit,160,40,75,25,5
EndDialog>Dialog1

Show>Dialog1

//get handle of Test Dialog & msEdit1 edit box
LibFunc>user32,FindWindowA,dlgHwnd,TForm,Test Dialog
LibFunc>user32,FindWindowExA,edtHwnd,dlgHwnd,0,TEdit,msEdit1
Let>edit_enabled=1

Label>ActionLoop
GetDialogAction>Dialog1,r
if>r=2,exit
if>r=5
if>edit_enabled=1
Let>edit_enabled=0
Let>Dialog1.msButton2=Enable Edit
else
Let>edit_enabled=1
Let>Dialog1.msButton2=Disable Edit
endif
LibFunc>user32,EnableWindow,nowt,edtHwnd,edit_enabled
ResetDialogAction>Dialog1
endif
Goto>ActionLoop
Label>exit
MJT Net Support
[email protected]

CatBreath
Junior Coder
Posts: 32
Joined: Fri Jul 08, 2005 6:12 pm

Post by CatBreath » Wed Aug 03, 2005 7:18 pm

Great!
thanks!

ShaneCl
Newbie
Posts: 13
Joined: Sun Apr 24, 2005 2:18 am
Location: Toowoomba - Aust

Objects in the window API

Post by ShaneCl » Wed Jun 21, 2006 12:43 am

I am using your libfunc code to enable and disable certain text boxs in my dialogs. But I am unable to do the same with radiogroups.

Can someone advise the correct way to identify a radio group or radio button using

LibFunc>user32,FindWindowA,dlgHwnd,TForm,Test Dialog
LibFunc>user32,FindWindowExA,edtHwnd,dlgHwnd,0,TEdit,msEdit1

Thankyou

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts