Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Treeview disabled
Message
De
30/06/2006 01:57:07
 
 
À
29/06/2006 18:09:07
Joel Leach
Memorial Business Systems, Inc.
Tennessie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
01132931
Message ID:
01132981
Vues:
14
This message has been marked as the solution to the initial question of the thread.
>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
Herman
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform