Topic Specific Tutorials and Tips.
Moderator: Rathinagiri
bpd2000
Posts: 1207 Joined: Sat Sep 10, 2011 4:07 am
Location: India
Post
by bpd2000 » Thu Aug 21, 2014 9:06 am
Find working example to Disable [Dim] / Enable Close Button "X"
Code: Select all
/*
HMG Sample :
"Demo Disable / Enable Close Button 'X'"
By BPD2000
August 2014
*/
#include <hmg.ch>
PROCEDURE Main()
define window main at 0, 0 width 400 height 300 main title "Demo Disable / Enable Close Button 'X'"
define button click
row 100
col 10
caption 'Click'
action msginfo( 'Just a test' )
end button
define button Disablex
row 140
col 10
caption "Disable X"
action (NOCLOSEDLG(thiswindow.handle), MSGINFO("Disabled Close Button 'X'", "Action"))
end button
define button Enablex
row 180
col 10
caption "Enable X"
action (CLOSEDLG(thiswindow.handle), MSGINFO("Enabled Close Button 'X'", "Action"))
end button
end window
Main.Center
Main.Activate
RETURN // Main()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
HB_FUNC ( NOCLOSEDLG ) // ( hWnd )
{
HMENU hMenu = GetSystemMenu( ( HWND ) hb_parnl( 1 ), FALSE ) ;
EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED ) ;
}
HB_FUNC ( CLOSEDLG ) // ( hWnd ) MF_ENABLED
{
HMENU hMenu = GetSystemMenu( ( HWND ) hb_parnl( 1 ), FALSE ) ;
EnableMenuItem( hMenu, SC_CLOSE, MF_ENABLED ) ;
}
#pragma ENDDUMP
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
BPD
Convert Dream into Reality through HMG
esgici
Posts: 4543 Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:
Post
by esgici » Thu Aug 21, 2014 11:01 am
bpd2000 wrote: Find working example to Disable [Dim] / Enable Close Button "X"
Tested, worked fine
Thanks Dave
Regards
Viva
INTERNATIONAL HMG
Pablo César
Posts: 4059 Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Post
by Pablo César » Thu Aug 21, 2014 11:24 am
Thanks Dave for sharing !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Javier Tovar
Posts: 1275 Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México
Post
by Javier Tovar » Fri Aug 22, 2014 3:29 am
Gracias por el ejemplo, bueno!
Saludos
bpd2000
Posts: 1207 Joined: Sat Sep 10, 2011 4:07 am
Location: India
Post
by bpd2000 » Fri Aug 22, 2014 4:41 pm
Code for Console application
Code: Select all
/*
Disable / Enable close button in console application"
Code by BPD2000
*/
#include "hbgtinfo.ch"
#include "Inkey.ch"
REQUEST HB_GT_WIN_DEFAULT
function Main()
LOCAL nChoice := 1
SET WRAP ON
SET MESSAGE TO 23 CENTER
SET( _SET_EVENTMASK, INKEY_KEYBOARD + INKEY_LDOWN )
setcolor( "N/W,N/GR*,,,N/W*" )
SetMode( 25, 80 )
CLS
DO WHILE (LASTKEY() != K_ESC)
@ 6, 30 PROMPT "Disable_X" MESSAGE "Disable close button in console application"
@ 7, 30 PROMPT "Enable_X " MESSAGE "Enable close button in console application"
@ 9, 30 PROMPT "Quit " MESSAGE "Return to DOS"
MENU TO nChoice
DO CASE
CASE nChoice = 0
QUIT
CASE nChoice = 1
Disable_X()
CASE nChoice = 2
Enable_X()
CASE nChoice = 3
QUIT
ENDCASE
ENDDO
RETURN
Function Disable_X
hb_GtInfo( HB_GTI_CLOSABLE, .F. )
Return
Function Enable_X
hb_GtInfo( HB_GTI_CLOSABLE, .T. )
Return
BPD
Convert Dream into Reality through HMG
abinfra
Posts: 68 Joined: Sat Jan 25, 2014 7:25 am
DBs Used: DBF
Post
by abinfra » Fri Aug 22, 2014 5:45 pm
Thank you really bpd2000.
A hug.
LOUIS
Posts: 204 Joined: Tue Dec 11, 2012 9:05 pm
DBs Used: DBF
Post
by LOUIS » Fri Aug 22, 2014 5:47 pm
bpd2000
You are a Genius !!!
Thank You very much !!!
You solved my problem of many years
HMG I LOVE YOU !!!
abinfra
Posts: 68 Joined: Sat Jan 25, 2014 7:25 am
DBs Used: DBF
Post
by abinfra » Fri Aug 22, 2014 6:53 pm
bpd2000, could inform me that serves the following statement:
Code: Select all
SET( _SET_EVENTMASK, INKEY_KEYBOARD + INKEY_LDOWN )
Thanks in advance.
Antonio Belando
abinfra
Posts: 68 Joined: Sat Jan 25, 2014 7:25 am
DBs Used: DBF
Post
by abinfra » Fri Aug 22, 2014 10:37 pm
The following example will inform INKEY() to terminate if a keyboard event occurs or the left mouse button has been clicked.
SET EVENTMASK TO INKEY_KEYBOARD + INKEY_LDOWN
abinfra wrote: bpd2000, could inform me that serves the following statement:
Code: Select all
SET( _SET_EVENTMASK, INKEY_KEYBOARD + INKEY_LDOWN )
Thanks in advance.
Antonio Belando
bpd2000
Posts: 1207 Joined: Sat Sep 10, 2011 4:07 am
Location: India
Post
by bpd2000 » Sat Aug 23, 2014 3:21 am
abinfra wrote: The following example will inform INKEY() to terminate if a keyboard event occurs or the left mouse button has been clicked.
SET EVENTMASK TO INKEY_KEYBOARD + INKEY_LDOWN
abinfra wrote: bpd2000, could inform me that serves the following statement:
Code: Select all
SET( _SET_EVENTMASK, INKEY_KEYBOARD + INKEY_LDOWN )
Thanks in advance.
Antonio Belando
You may remove SET EVENTMASK TO INKEY_KEYBOARD + INKEY_LDOWN if you not require
BPD
Convert Dream into Reality through HMG