Make a dialog never lost focus

Re: Make a dialog never lost focus

Postby MGA » Wed Aug 20, 2014 8:08 pm

static oTimer, oWnd, oButton[2]

#Define SW_MINIMIZE 6
#Define SW_RESTORE 9

/*******************************/
function Main()
/*
*/
define window ownd from 10, 10 to 20, 30 ;
nozoom ;
noiconize ;
nosysmenu ;
no caption ;
border none title 'Focus Test Application '

@ 3, 5 BUTTON oButton[1] prompt "&Ok" SIZE 40, 20 ACTION MsgInfo( "Any action here!" )
@ 3, 16 BUTTON oButton[2] prompt "&Cancel" SIZE 40, 20 ACTION oWnd:End() cancel

define timer oTimer of oWnd interval 1000 action(oTimer:Deactivate(), TestFocusApp(), oTimer:Activate())

activate window ownd on init(setwindowpos( oWnd:hwnd, -1, 0, 0, 0, 0, 3 ),obutton[1]:setfocus(),otimer:activate())

return nil

/**************************************/
static function TestFocusApp()
/*
*/
if !oButton[1]:lfocused .and. !oButton[2]:lfocused
ShowWindow(ownd:hwnd, SW_MINIMIZE)
ShowWindow(ownd:hwnd, SW_RESTORE)
endif
return .t.
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: Make a dialog never lost focus

Postby James Bott » Thu Aug 21, 2014 2:31 pm

How about something like:

oDlg:bLostFocus:= {|oDlg| SetActiveWindow(oDlg:hWnd)}
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 32 guests