FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to keep a appl. on top of the dlg on resize ? (solved)
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
How to keep a appl. on top of the dlg on resize ? (solved)
Posted: Fri Jul 31, 2015 05:33 PM
Hello,

I have 2 questions :

The situation : from inside the RGB-tool I call the colorpicker ( exe )

1. how to close the colorpicker as well, using the exit button from the RGB-tool ?
2. how to keep the colorpicker on top after minimize / maximize the RGB-tool ?

Added : calling the Colorpicker ( standalone exe ) from inside the RGB-tool



best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: How to keep a appl. on top of the dialog on resize ?
Posted: Fri Jul 31, 2015 09:09 PM
ukoenig wrote:Hello,

I have 2 questions :

The situation : from inside the RGB-tool I call the colorpicker ( exe )

1. how to close the colorpicker as well, using the exit button from the RGB-tool ?
2. how to keep the colorpicker on top after minimize / maximize the RGB-tool ?

Added : calling the Colorpicker ( standalone exe ) from inside the RGB-tool

best regards
Uwe :-)


Try
To close external application:
Code (fw): Select all Collapse
SendMessage( FindWindow( 0, "ColorPicker" ), WM_CLOSE )
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How to keep a appl. on top of the dialog on resize ?
Posted: Sat Aug 01, 2015 07:17 AM
Thank You very much for the response

the defined EXE-names
RGB.exe
Colorpick.exe

The following lines are included in RGB.prg the time I added the Colorpick-button, but doesn't work
..
DEFINE DIALOG oDlg RESOURCE "RGB" PIXEL ;
FONT oFont TITLE "RGB-colors and Gradients => Release 4.3 / 10.02.2015" OF oDlg
..

exit button in RGB.prg

REDEFINE BTNBMP oSBtn[16] OF oDlg ;
ID 580 PIXEL 2007 ;
NOBORDER ;
PROMPT "&Exit RGB-colors" ;
FILENAME c_path1 + "Exit.Bmp" ;
ACTION ( SendMessage( FindWindow( 0, "COLORPICK" ), WM_CLOSE ), oDlg:End() ) ;
FONT oFont1 ;
LEFT


the defined Line in RGB.prg, to keep the colorpicker on top using minimize / maximize of RGB.exe

oDlg:bResized := {|| ON_TOP() }

ACTIVATE DIALOG oDlg CENTERED
..
..
RETURN NIL

// ----

FUNCTION ON_TOP()
CFILENAME := "COLORPICK.exe"
IF ISEXERUNNING( CFILENAME( HB_ARGV( 0 ) ) )
SHOWWINDOW( FINDWINDOW( 0, "COLORPICK" ), 9 )
SETFOREGROUNDWINDOW( FINDWINDOW( 0, "COLORPICK" ) )
ENDIF
RETURN NIL


both are not working

The main-lines from Colorpick.prg


..
..
DEFINE WINDOW oWnd FROM 10, 10 TO 270, 290 PIXEL TITLE "COLOR-PICKER 1.1"
..
..
DEFINE TIMER oTimer OF oWnd ;
INTERVAL 70 ACTION ( nRGB := GetColor(), ;
nRed := nRGBRed( nRGB ), ;
nGreen := nRGBGreen( nRGB ), ;
nBlue := nRGBBlue( nRGB ), ;
cRGB := "nRGB( " + ALLTRIM(STR(nRed)) + ", " + ;
ALLTRIM(STR(nGreen)) + ", " + ;
ALLTRIM(STR(nBlue)) + " )", ;
oSay2:Refresh(), oSay3:Refresh() )

oTimer:Activate()
oWnd:bKeyDown := {|nKey| IF(nKey = nWKey, SAVE_COLOR(), ) }

ACTIVATE WINDOW oWnd CENTER

oTimer:DeActivate()

RETURN NIL


I tested including the Colorpick-source, but I noticed some problems ( maybe the timer )
I think a extra EXE-file is the better solution.

best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to keep a appl. on top of the dialog on resize ?
Posted: Sat Aug 01, 2015 08:08 AM

Uwe,

Great work as usual! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How to keep a appl. on top of the dialog on resize ?
Posted: Sat Aug 01, 2015 08:56 AM
Antonio,

thank You very much. I hope it is useful

here is a little test, what I'm trying to do from inside the RGB-tool to make it complete.
The test includes the 2 buttons of the RGB-main-dialog and the Colorpicker.

< Daniel Cuatecatl Leon > got the download-link of the colorpicker-source.
Tested and worked fine for him ( worked as well with older FWH-releases ).


Download :
http://www.pflegeplus.com/DOWNLOADS/TestPick1.zip



best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How to keep a appl. on top of the dialog on resize ?
Posted: Sat Aug 01, 2015 01:03 PM
Both needed solutions are working fine now using FUNCTION TOP_CLOSE(nType) !!!

bring on top nType = 1
close nType = 2


Download :
http://www.pflegeplus.com/DOWNLOADS/TestPick2.zip

#define GW_CHILD 5
#define GW_HWNDNEXT 2
#define SW_RESTORE 9
,,,
,,,
FUNCTION TOP_CLOSE(nType)

hWnd := FindWnd( "COLOR-PICKER 1.1" ) // Title !!!
IF hWnd != NIL
IF ISICONIC( hWnd )
SHOWWINDOW( hWnd, SW_RESTORE )
ENDIF
IF nType = 1
SETFOREGROUNDWINDOW( hWnd )
ENDIF
IF nType = 2
SENDMESSAGE( hWnd, WM_CLOSE )
ENDIF
ELSE
MsgAlert( "COLORPICKER is not running !", "Attention" )
ENDIF

RETURN NIL

// ----------

FUNCTION FINDWND( cTitle )
local hWnd := GetWindow( GetDesktopWindow(), GW_CHILD )

WHILE hWnd != 0
IF Upper( cTitle ) $ Upper( GetWindowText( hWnd ) )
RETURN hWnd
ENDIF
hWnd = GetWindow( hWnd, GW_HWNDNEXT )
END

RETURN NIL


best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion