Simple Tutorial - 7 : Buttons

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

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

Simple Tutorial - 7 : Buttons

Post by esgici »

Simple tutorial based upon HMG Offical Tutorial for beginners.

Pushing Actions (Standard Buttons)

Another way for let the users to take an action (besides menus) are buttons.

Code: Select all

@ 10,10 BUTTON Button_1 CAPTION 'Click Here!' ACTION MsgInfo('Button Clicked!')

Code: Select all

#include <minigui.ch>

Function Main

    DEFINE WINDOW Win_1 ;
        AT 0,0 ;
        WIDTH 400 ;
        HEIGHT 200 ;
        TITLE 'Button Test' ;
        MAIN

        @ 10,10 BUTTON Button_1 ;
            CAPTION 'Click Here!' ;
                    ACTION MsgInfo('Button Clicked!')

    END WINDOW
   
    CENTER   WINDOW Win_1
    ACTIVATE WINDOW Win_1

Return

[img]http://vivaclipper.googlepages.com/StdButtons.jpg/StdButtons-medium.jpg[/img]

[b][color=#0000FF]Being More Graphical (Picture Buttons)[/color][/b]

Instead or together with a text caption you can use a picture.

@ 10,10 BUTTON PictureButton_1 ;
    PICTURE 'button.bmp' ;
    ACTION MsgInfo('Picture Button Clicked!!') ;
    WIDTH 27 ;
    HEIGHT 27 ;
    TOOLTIP 'Picture Button Tooltip'

#include "minigui.ch"

Function Main

    DEFINE WINDOW Win_1 ;
        AT 0,0 ;
        WIDTH 400 ;
        HEIGHT 200 ;
        TITLE 'Picture Button Test' ;
        MAIN

            @ 10,10 BUTTON PictureButton_1 ;
                PICTURE 'button.bmp' ;
                ACTION MsgInfo('Picture Button Clicked!!') ;
                WIDTH 27 ;
                HEIGHT 27 ;
                TOOLTIP 'Picture Button Tooltip'

    END WINDOW

    CENTER   WINDOW Win_1
    ACTIVATE WINDOW Win_1

Return
Image

The optional tooltip clause, causes that a small window with an explanatory text be displayed when the mouse pointer stays over the control for a few seconds. You can use this clause with most MiniGUI controls.

Regards

esgici
Viva INTERNATIONAL HMG :D
Post Reply