Page 1 of 1

How to test if StatusBar is defined in current window?

Posted: Sun Oct 18, 2009 10:03 am
by mol
i need to test if status bar is defined.
Do anybody know how to do it?

Re: How to test if StatusBar is defined in current window?

Posted: Sun Oct 18, 2009 10:20 am
by gfilatov
mol wrote:i need to test if status bar is defined.
Do anybody know how to do it?
Hi,

Please be so kind to try the following working sample:

Code: Select all

#include "minigui.ch"

Function Main

	SET DATE GERMAN

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 640 ;
		HEIGHT 400 ;
		TITLE 'Statusbar Keyboard Demo' ;
		MAIN 

		DEFINE STATUSBAR FONT 'Arial' SIZE 9
			STATUSITEM "Statusbar Demo"
			KEYBOARD
			DATE 
			CLOCK 
		END STATUSBAR
 
	END WINDOW

msginfo( Iif(IsControldefined( Statusbar, Form_1 ), "TRUE", "FALSE") )

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return
;)

Re: How to test if StatusBar is defined in current window?

Posted: Sun Oct 18, 2009 11:07 am
by mol
I've tried to go this way earlier, but I always got information that statusbar is not defined.

So, Grigori, your sample doesn't work :-(

Re: How to test if StatusBar is defined in current window?

Posted: Sun Oct 18, 2009 11:14 am
by gfilatov
mol wrote:I've tried to go this way earlier, but I always got information that statusbar is not defined.

So, Grigori, your sample doesn't work :-(
Hi Marek,

Sorry but try an aboved sample :!:

It works fine with HMG 3.0 Test VI:
- modified sample demo3.prg at your folder hmg\samples\statusbar;
- compiled by command build.bat demo3
- look for message "TRUE" :idea:

Re: How to test if StatusBar is defined in current window?

Posted: Sun Oct 18, 2009 11:16 am
by mol
I must excuse you!
It works!
I've tried

Code: Select all

 IsControlDefined (cWindowName, "StatusBar")
but a trick relys on cWindowName - it was variable containing name of window

I've changed in my program for:

Code: Select all

 IsControlDefined (&cWindowName, StatusBar)
and it starts to work!

Many thanks, Grigori