Simple Tutorial - 15 : More Organization

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
esgici
Posts: 4335
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 221 times
Been thanked: 76 times
Contact:

Simple Tutorial - 15 : More Organization

Post by esgici » Fri Aug 01, 2008 1:48 am

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: 200
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 6 times

Post by franco » Fri Apr 14, 2017 5:27 am

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.

User avatar
Anand
Posts: 198
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 22 times
Been thanked: 33 times

Post by Anand » Fri Apr 14, 2017 10:38 am

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
Image

franco
Posts: 200
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 6 times

Post by franco » Fri Apr 14, 2017 4:35 pm

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

User avatar
mol
Posts: 2835
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 118 times
Been thanked: 63 times
Contact:

Post by mol » Fri Apr 14, 2017 7:08 pm

Include your bmp files into resources. They will be linked into exe file

User avatar
Anand
Posts: 198
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 22 times
Been thanked: 33 times

Post by Anand » Sat Apr 15, 2017 11:30 am

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 870 times
Regards,

Anand
Attachments
test_exe.zip
(1.53 MiB) Downloaded 57 times
test_src.zip
(6.95 KiB) Downloaded 51 times
Image

franco
Posts: 200
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 6 times

Post by franco » Sun Apr 16, 2017 4:04 pm

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

User avatar
Anand
Posts: 198
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 22 times
Been thanked: 33 times

Post by Anand » Mon Apr 17, 2017 8:13 am

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 800 times
Image

franco
Posts: 200
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 6 times

Post by franco » Mon Apr 17, 2017 8:28 am

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

User avatar
Anand
Posts: 198
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 22 times
Been thanked: 33 times

Post by Anand » Mon Apr 17, 2017 9:46 am

Hi Franco,

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

Regards,

Anand
Image

Post Reply