IonicWind Software

Aurora Compiler => GUI => Topic started by: Rock Ridge Farm (Larry) on February 10, 2006, 07:43:11 PM

Title: More help
Post by: Rock Ridge Farm (Larry) on February 10, 2006, 07:43:11 PM
If I add a control disabled - how do I enable it later?
Is there a setcontrol class?
Title: Re: More help
Post by: Parker on February 10, 2006, 08:11:00 PM
As far as I know, EnableWindow (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/enablewindow.asp)

declare import, EnableWindow(unsigned int hWnd, int bEnable),int;

...
EnableWindow(pControl->m_hWnd, 1); // To enable the control


is the only way.
Title: Re: More help
Post by: Rock Ridge Farm (Larry) on February 10, 2006, 09:03:11 PM
Need to give me more detail on how to do this.
This is the initial declarition line:
   d1.AddControl(CTLISTVIEW,"",10,10,500,145,
      AWS_DISABLED|ALVS_REPORT|AWS_BORDER|AWS_HSCROLL|AWS_VSCROLL,AWS_EX_CLIENTEDGE,LISTVIEW_1);
What would turn it on?
Title: Re: More help
Post by: Parker on February 10, 2006, 09:14:18 PM
You can use the GetDlgItem function to get an HWND to pass to EnableWindow, it would look like this
EnableWindow(GetDlgItem(d1.m_hWnd, LISTVIEW_1), 1);
sorry I'm a little busy, you'll have to convert the declare from msdn
Title: Re: More help
Post by: Bruce Peaslee on February 10, 2006, 11:03:03 PM
Controls are enabled by default.
Title: Re: More help
Post by: Parker on February 10, 2006, 11:17:45 PM
But not if they're disabled. See above, AWS_DISABLED is explicitly passed.

For GetDlgItem, insert this into your code
import unsigned int GetDlgItem(unsigned int hDlg, int nIDDlgItem);
Title: Re: More help
Post by: Bruce Peaslee on February 10, 2006, 11:24:10 PM
Ouch. Got me.

I better get some sleep (no cracks please, Paul) - I'll look again tomorrow.
Title: Re: More help
Post by: Rock Ridge Farm (Larry) on February 11, 2006, 07:56:42 AM
Yes it is disabled at start - I want to be able to turn it off/on on demand.
Title: Re: More help
Post by: Ionic Wind Support Team on February 11, 2006, 08:02:16 AM
Just use GetControl to get a pointer to the control.  If you in a method of the dialog:

pControl = GetControl(id);
EnableWindow(pControl->m_hWnd, true);

Or if your not in a method of the dialog

pControl = dlg.GetControl(id);
EnableWindow(pControl->m_hWnd, true);

The is no reason to use GetDlgItem
Title: Re: More help
Post by: Rock Ridge Farm (Larry) on February 13, 2006, 09:13:25 AM
I looked in the includes - is EnableWindow a function?
I can not find it.
Title: Re: More help
Post by: Bruce Peaslee on February 13, 2006, 09:55:13 AM
I found this in keno.src

DECLARE IMPORT,EnableWindow(hwnd as int,bEnable as int),int;
Title: Re: More help
Post by: Rock Ridge Farm (Larry) on February 13, 2006, 09:58:37 AM
That solves the compile error - now the program just crashes.
:'(
Title: Re: More help
Post by: Rock Ridge Farm (Larry) on February 13, 2006, 10:03:30 AM
Got past the crash but still does not make the listview visable.
Title: Re: More help
Post by: Parker on February 13, 2006, 11:57:00 AM
I had the same problem when I was testing this, it looks like the listview doesn't revert back to the correct color, but is still enabled. If there is a function to set the color of a listview control, try putting that right after the EnableWindow call and see if it works.