Page 1 of 3

Simple Tutorial - 15 : More Organization

Posted: Fri Aug 01, 2008 1:48 am
by esgici
Simple tutorial based upon HMG Offical Tutorial for beginners.

More Organization (TOOLBAR Control)


Toolbars are used to group command buttons in a bar located (usually) at window top (under main menu bar).

Code: Select all

#include "minigui.ch"

Function Main

    DEFINE WINDOW Win_1 ;
        AT 0,0 ;
        WIDTH 640 HEIGHT 480 ;
        TITLE 'ToolBar Test' ;
        MAIN

        DEFINE MAIN MENU
            POPUP '&File'
                ITEM '&Disable ToolBar Button' ACTION ;
                      Win_1.Button_1.Enabled := .F.
                ITEM '&Enable ToolBar Button'  ACTION ;
                      Win_1.Button_1.Enabled := .T.
                ITEM '&Exit' ACTION Win_1.Release
            END POPUP
        END MENU

        DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 40,40 FLAT BORDER

            BUTTON Button_1 ;
                CAPTION '&New' ;
                PICTURE 'edit_new.bmp' ;
                ACTION MsgInfo('Click! New')

            BUTTON Button_2 ;
                CAPTION '&Edit' ;
                PICTURE 'edit_edit.bmp' ;
                ACTION MsgInfo('Click! Edit')

            BUTTON Button_3 ;
                CAPTION '&Find' ;
                PICTURE 'edit_find.bmp' ;
                ACTION MsgInfo('Click! Find') ;
                SEPARATOR

        END TOOLBAR

    END WINDOW

    CENTER   WINDOW Win_1
    ACTIVATE WINDOW Win_1

Return Nil
Image

Regards

esgici

Re: Simple Tutorial - 15 : More Organization

Posted: Fri Apr 14, 2017 5:27 am
by franco
Help
Is there a way to have a toolbar with no picture but multi line caption. I can not get multiline to work.
I use HMG 3.2 windows 8.1
DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 40,40 FLAT BORDER

BUTTON Button_1 ;
CAPTION 'F2 .......'&New' ;
ACTION MsgInfo('Click! New')
END TOOLBAR
I would like toolbar caption to say F2 above the &New on the button no pictures
Franco.

Re: Simple Tutorial - 15 : More Organization

Posted: Fri Apr 14, 2017 10:38 am
by Anand
Hi Franco,

I checked and it looks like toolbar do not support multi line.
Though you can have multi line buttons on the window area but not on the toolbar.

May be other members can give some workaround here.

Regards,

Anand

Re: Simple Tutorial - 15 : More Organization

Posted: Fri Apr 14, 2017 4:35 pm
by franco
Thank you Anand,
Do You know if there are any .bmp`s built right into hmg. My problem is I don`t want to distribute a lot bmp files to my clients.
Franco

Re: Simple Tutorial - 15 : More Organization

Posted: Fri Apr 14, 2017 7:08 pm
by mol
Include your bmp files into resources. They will be linked into exe file

Re: Simple Tutorial - 15 : More Organization

Posted: Sat Apr 15, 2017 11:30 am
by Anand
Hi Franco,

Yes, as Mol said, you only need to add your images in the resource file and the exe will contain it.

I have made the required resouce file with some images of your tool bar code. Run the exe and see it will show the images. You do not need to distribute the images to the client.
2017-04-15_170008.png
2017-04-15_170008.png (8.28 KiB) Viewed 4566 times
Regards,

Anand

Re: Simple Tutorial - 15 : More Organization

Posted: Sun Apr 16, 2017 4:04 pm
by franco
WOW, This is what I enjoy about HMG. There is always a solution for most problems by knowledgeable members.
I will Make my bmp`s. Is there any colored function key bmp`s already made that you know of. I wanted a (red) or colored box with (F1) and so on on them.
Thank you both for your help.
Franco

Re: Simple Tutorial - 15 : More Organization

Posted: Mon Apr 17, 2017 8:13 am
by Anand
Hi franco,

I could not find individual keys but found this image, attached.
See if it helps you. You may have to use image editor on it.

Regards,

Anand

Re: Simple Tutorial - 15 : More Organization

Posted: Mon Apr 17, 2017 8:28 am
by franco
Thanks Anand, I still can not get it to work for me.
I built my own f.bmp`s and put them in the hmg 3.2 resources folder. Then entered there names as you suggested in my resource area of my program.
I have the bmps in my program folder, so they work when I compile. When I copy the exe to a different folder without the bmps they do not show up.
I even tried the edit_new.bmp but again it will not show up, and it is in the 3.2 resources folder.
I am using 8.1 and hmg 3.2 and my program starts with #include <hmg.ch> ... not minigui.
Any thoughts ..... Franco

Re: Simple Tutorial - 15 : More Organization

Posted: Mon Apr 17, 2017 9:46 am
by Anand
Hi Franco,

It is simple. Just upload your code source here and we can detect the bug.

Regards,

Anand