Page 1 of 1

Tool button without Picture clause

Posted: Sat Nov 14, 2009 12:57 am
by Rathinagiri
Should a tool button have picture definitely? Can't we omit the same?

In this toolbar_2 sample, I had omitted the picture for button 3_c and it gives run time error. :(

Code: Select all

/*
 * MINIGUI - Harbour Win32 GUI library Demo
 *
 * Copyright 2002 Roberto Lopez <harbourminigui@gmail.com>
 * http://harbourminigui.googlepages.com/
*/

#include "minigui.ch"

Function Main

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 640 HEIGHT 480 ;
		TITLE 'MiniGUI ToolBar Demo' ;
		ICON 'DEMO.ICO' ;
		MAIN ;
		FONT 'Arial' SIZE 10 

		DEFINE STATUSBAR
			STATUSITEM 'HMG Power Ready!' 
		END STATUSBAR

		DEFINE MAIN MENU 
			POPUP '&File'
				ITEM 'Get ToolBar_3 Button_1'	    ACTION MsgInfo ( if ( Form_1.Button_1c.Value , '.T.' , '.F.' ) , 'Button_1c' )
				ITEM 'Get ToolBar_3 Button_2'	    ACTION MsgInfo ( if ( Form_1.Button_2c.Value , '.T.' , '.F.' ) , 'Button_2c' )
				ITEM 'Get ToolBar_3 Button_3'	    ACTION MsgInfo ( if ( Form_1.Button_3c.Value , '.T.' , '.F.' ) , 'Button_3c' )
				ITEM 'Get ToolBar_3 Button_4'	    ACTION MsgInfo ( if ( Form_1.Button_4c.Value , '.T.' , '.F.' ) , 'Button_4c' )
	    			SEPARATOR	
				ITEM 'Set ToolBar_3 Button_1'	    ACTION Form_1.Button_1c.Value := .T. 
				ITEM 'Set ToolBar_3 Button_2'	    ACTION Form_1.Button_2c.Value := .T. 
				ITEM 'Set ToolBar_3 Button_3'	    ACTION Form_1.Button_3c.Value := .T. 
				ITEM 'Set ToolBar_3 Button_4'	    ACTION Form_1.Button_4c.Value := .T. 
			    	SEPARATOR	
				ITEM '&Exit'			ACTION Form_1.Release
			END POPUP
			POPUP '&Help'
				ITEM '&About'		ACTION MsgInfo ("MiniGUI ToolBar demo") 
			END POPUP
		END MENU

		DEFINE SPLITBOX 

			DEFINE TOOLBAR ToolBar_a BUTTONSIZE 45,40 FONT 'Arial' SIZE 8  FLAT

				BUTTON Button_1a ;
					CAPTION '&Undo' ;
					PICTURE 'button4.bmp' ;
					ACTION MsgInfo('Click! 1')

				BUTTON Button_2a ;
					CAPTION '&Save' ;
					PICTURE 'button5.bmp' ;
					WHOLEDROPDOWN 

					DEFINE DROPDOWN MENU BUTTON Button_2a 
						ITEM 'Exit'	ACTION Form_1.Release
						ITEM 'About'	ACTION MsgInfo ("MiniGUI ToolBar Demo") 
					END MENU

				BUTTON Button_3a ;
					CAPTION '&Close' ;
					PICTURE 'button6.bmp' ;
					ACTION MsgInfo('Click! 3') ;
					DROPDOWN

					DEFINE DROPDOWN MENU BUTTON Button_3a 
						ITEM 'Disable ToolBar 1 Button 1'	ACTION Form_1.Button_1a.Enabled := .F.
						ITEM 'Enable ToolBar 1 Button 1'	ACTION Form_1.Button_1a.Enabled := .T.
					END MENU

			END TOOLBAR

			DEFINE TOOLBAR ToolBar_b BUTTONSIZE 45,40 FONT 'ARIAL' SIZE 8 FLAT 

				BUTTON Button_1b ;
					CAPTION 'More ToolBars...' ;
					PICTURE 'button7.bmp' ;
					ACTION MsgInfo('Click! 2'); 

				BUTTON Button_2b ;
					CAPTION 'Button 2' ;
					PICTURE 'button8.bmp' ;
					ACTION MsgInfo('Click! 2'); 
					SEPARATOR

				BUTTON Button_3b ;
					CAPTION 'Button 3' ;
					PICTURE 'button7.bmp' ;
					ACTION MsgInfo('Click! 3')

			END TOOLBAR

			DEFINE TOOLBAR ToolBar_c BUTTONSIZE 45,40 FONT 'Arial' SIZE 8 CAPTION 'ToolBar 3' FLAT

				BUTTON Button_1c ;
					CAPTION 'Check 1' ;
					PICTURE 'button4.bmp' ;
					ACTION MsgInfo('Hey!');
					CHECK GROUP

				BUTTON Button_2c ;
					CAPTION 'Check 2' ;
					PICTURE 'button5.bmp' ;
					ACTION MsgInfo('Hey!') ; 
					CHECK GROUP

				BUTTON Button_3c ;
					CAPTION 'Check 3' ;
					ACTION MsgInfo('Hey!') ;
					SEPARATOR;
					CHECK GROUP

				BUTTON Button_4c ;
					CAPTION 'Help Check' ;
					PICTURE 'button9.bmp' ;
					ACTION MsgInfo('Hey!') ;
					CHECK 

			END TOOLBAR

		END SPLITBOX

	END WINDOW

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return Nil



Re: Tool button without Picture clause

Posted: Sat Nov 14, 2009 1:10 am
by Roberto Lopez
rathinagiri wrote:Should a tool button have picture definitely? Can't we omit the same?

In this toolbar_2 sample, I had omitted the picture for button 3_c and it gives run time error. :(
It's true.

Toolbar code could be changed to allow mixed toolbars with image buttons and non-image buttons work properly.

I'll work on it.

Re: Tool button without Picture clause

Posted: Sat Nov 14, 2009 2:34 am
by Roberto Lopez
Roberto Lopez wrote:
rathinagiri wrote:Should a tool button have picture definitely? Can't we omit the same?

In this toolbar_2 sample, I had omitted the picture for button 3_c and it gives run time error. :(
It's true.

Toolbar code could be changed to allow mixed toolbars with image buttons and non-image buttons work properly.

I'll work on it.
Replacing c_toolbar.c and h_toolbar.prg with attached versions you could omit pictures on buttons.

Anyway, I guess that this is not a good thing.

Re: Tool button without Picture clause

Posted: Sat Nov 14, 2009 5:31 am
by Rathinagiri
Oh. Thanks Roberto.
Anyway, I guess that this is not a good thing.
Again thanks for pointing out Roberto. I would specify a picture rather. :)

Re: Tool button without Picture clause

Posted: Sat Nov 14, 2009 1:38 pm
by Roberto Lopez
rathinagiri wrote:Oh. Thanks Roberto.
Anyway, I guess that this is not a good thing.
Again thanks for pointing out Roberto. I would specify a picture rather. :)
Ok. :)

In fact this error checking comes from a ToolBar bug report.

Someone reported a malfunction in ToolBar, but the fact was that the picture was missed :)