Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Taskbar control
Message
From
11/11/2005 18:37:07
 
 
To
11/11/2005 08:54:08
Dorin Vasilescu
ALL Trans Romania
Arad, Romania
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01067578
Message ID:
01067988
Views:
23
Dorin--

Thanks for the great control. :)

I made some changes to the control for handling modal windows. I would not expect that a modal window to display on the taskbar; additionally, when a modal form is active, the taskbar should not change the focus to another form. To accomplish this, I changed the following code:

In the Taskbar::AddFormButton method:
IF VARTYPE(oForm.WindowType) = "N"
	IF NOT oForm.Caption=='' AND oForm.ShowWindow!=2 AND ;
	   oForm.WindowType!=1 AND oForm.BaseClass=='Form'
		* hWnd is from some active non top level form, next check button collection to
		* see ifalready exists a button assigned to it
		lAddFormOK = .T.
		FOR EACH oButton IN this.cnt_windows.opg_windows.Buttons
			IF oButton.formhWnd = hWnd
				lAddFormOk = .f.
				EXIT
			ENDIF 
		ENDFOR 
	ENDIF
ELSE
	IF NOT oForm.Caption=='' AND oForm.ShowWindow!=2 AND oForm.BaseClass=='Form'
		* hWnd is from some active non top level form, next check button collection to 
		* see if already exists a button assigned to it
		lAddFormOK = .T.
		FOR EACH oButton IN this.cnt_windows.opg_windows.Buttons
			IF oButton.formhWnd = hWnd
				lAddFormOk = .f.
				EXIT
			ENDIF 
		ENDFOR 
	ENDIF
ENDIF
The above code was inserting into the first FOR-EACH loop after the first IF-END. It was necessary to check if the WindowType property existed as some of the form handles did not have this property. The above code prevents a modal form from from being added to the taskbar.

To prevent the click event on the button when a modal form is active, the following was added in the Op_Window:Click event:
lModalWindow = .F.
FOR EACH oForm IN _screen.Forms
	IF VARTYPE(oForm.WindowType)="N" .AND. oForm.WindowType=1
		lModalWindow = .T.
		EXIT
	ENDIF
ENDFOR
IF !lModalWindow 
...
ENDIF
This was added before the FOR-EACH loop (the FOR-EACH loop goes inside the IF-ENDIF). This keeps the control from responding if a form is modal.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform