Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview disabled
Message
From
30/06/2006 10:03:31
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
 
 
To
30/06/2006 01:57:07
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
01132931
Message ID:
01133066
Views:
18
This worked! Thanks!

>>I'm having a weird problem with a Treeview. The scenario is kind of a strange one to begin with:
>>
>>- The Treeview is on a modal form.
>>- The modal form has a buton that calls a modeless form.
>>- When the modeless form is called, VFP puts it in a kinda,sorta modal mode. The code in the modal form continues to run after the modeless form is open, but menus are disabled and you can't click on other forms.
>>
>>So far, this is working exactly how I want it to. The problem occurs when I close the modeless form. The TreeView on the modal form is disabled. I can resize it, but none of the controls nor the scrollbar work in the treeview. I've tried resetting TreeView.Enabled (and TreeView.Object.Enabled) to .T., but it has no effect.
>>
>>Has anyone seen this one before? It does work properly when I change the modeless form to modal, but there is code in the modal form I want to run after the modeless form is open, so I can't do that.
>
>Hi Joel,
>
>AFAIK, when a modeless form/dialog called from a modal form/dialog, the modal one will set itself to disabled so the modeless can act like modal. When the modal form disabled, I think it also disabled the ActiveX control in VFP form. Why the ActiveX doesn't re-enable itself, I don't know <bg>. For more info, read EnableWindow() API in MSDN
>
>Anyway, to re-enable the TreeView, put this in TreeView Init event:
>
>** TreeView Init event
>Declare Long GetParent in User32 Long nhWnd
>Declare Long IsWindowEnabled in User32 Long nhWnd
>Declare Long EnableWindow in User32 Long nhWnd, Long bEnable
>
>This.AddProperty( 'hWndParent', GetParent( This.hWnd ))
>
>
>and put this in the modal form Activate event
>
>** Form Activate event
>If (IsWindowEnabled( ThisForm.oTreeView.hWndParent ) == 0)
>   EnableWindow( ThisForm.oTreeView.hWndParent, .T. )
>endif
>
>
>HTH
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform