FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Make a dialog never lost focus
Posts: 1286
Joined: Mon Feb 25, 2008 02:54 PM
Re: Make a dialog never lost focus
Posted: Wed Aug 20, 2014 08: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

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Make a dialog never lost focus
Posted: Thu Aug 21, 2014 02:31 PM

How about something like:

oDlg:bLostFocus:= {|oDlg| SetActiveWindow(oDlg:hWnd)}

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion