Simple Tutorial - 15 : More Organization

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Simple Tutorial - 15 : More Organization

Post 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
Viva INTERNATIONAL HMG :D
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Simple Tutorial - 15 : More Organization

Post 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.
All The Best,
Franco
Canada
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

Re: Simple Tutorial - 15 : More Organization

Post 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
Regards,

Anand

Image
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Simple Tutorial - 15 : More Organization

Post 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
All The Best,
Franco
Canada
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Simple Tutorial - 15 : More Organization

Post by mol »

Include your bmp files into resources. They will be linked into exe file
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

Re: Simple Tutorial - 15 : More Organization

Post 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 4564 times
Regards,

Anand
Attachments
test_exe.zip
(1.53 MiB) Downloaded 233 times
test_src.zip
(6.95 KiB) Downloaded 223 times
Regards,

Anand

Image
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Simple Tutorial - 15 : More Organization

Post 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
All The Best,
Franco
Canada
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

Re: Simple Tutorial - 15 : More Organization

Post 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
Attachments
P2M_fb_functionkeys.png
P2M_fb_functionkeys.png (41.81 KiB) Viewed 4494 times
Regards,

Anand

Image
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Simple Tutorial - 15 : More Organization

Post 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
All The Best,
Franco
Canada
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

Re: Simple Tutorial - 15 : More Organization

Post by Anand »

Hi Franco,

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

Regards,

Anand
Regards,

Anand

Image
Post Reply