Page 1 of 1

Two monitors, show different windows

Posted: Fri Oct 04, 2024 12:55 pm
by Adolfo
Hi fivewinners

I need to show some info in a second monitor, not to grab and place a window on mi 2nd monitor, but to work in the main one, and when need it show a window on the second one

Something like

Define Window .... of MONITOR1 algo asiii

or Activate Window on Paint GOTOMONITOR(2)


I can do mi work in mi main monitor, like a sale, and show photos, information on the second one, but controlled by me in the main one.

Any ideas.

From Chile
Adolfo

Re: Two monitors, show different windows

Posted: Fri Oct 04, 2024 11:02 pm
by nageswaragunupudi
There are different ways.
This is the simplest.

Code: Select all | Expand

DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd  ON INIT WndCenterEx( oWnd:hWnd, 2 ) // 2 means second monitor
Another way

Code: Select all | Expand

oMonitor2 := FW_GetMonitor( 2 )
DEFINE WINDOW oWnd FROM oMonitor2:Row(200), oMonitor2:Col(100) TO ;
   oMonitor2:Row(600),oMonitor2:Col(800) PIXEL
ACTIVATE WINDOW oWnd

Re: Two monitors, show different windows

Posted: Mon Oct 07, 2024 12:28 pm
by Adolfo
Thanks a lot NAGES

Going to try inmediately

Re: Two monitors, show different windows

Posted: Mon Oct 07, 2024 1:00 pm
by Adolfo
Nages

I get this error

Time from start: 0 hours 0 mins 7 secs
Error occurred at: 07/10/2024, 09:57:27
Error description: Error BASE/1004 Message not found: TMONITOR:NROW
Args:
[ 1] = O TMONITOR

Stack Calls
===========
Called from: ../../../tobject.prg => __ERRRT_SBASE( 0 )
Called from: ../../../tobject.prg => TMONITOR:ERROR( 0 )
Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
Called from: ../../../tobject.prg => TMONITOR:MSGNOTFOUND( 0 )
Called from: ../../../tobject.prg => TMONITOR:NROW( 0 )
Called from: .\source\function\getsysin.prg => (b)TMONITOR( 481 )
Called from: .\source\function\getsysin.prg => TMONITOR:ROW( 0 )

Called from
Local oMonitor2 := FW_GetMonitor( 2 )

DEFINE WINDOW oWnd2 FROM oMonitor2:Row(50), oMonitor2:Col(10) TO ;
oMonitor2:Row(700),oMonitor2:Col(900) PIXEL NOSYSMENU NOCAPTION


I'm using FWH 08/2024 MSVC

Re: Two monitors, show different windows

Posted: Mon Oct 07, 2024 1:10 pm
by nageswaragunupudi
Not :nRow()
Use :Row()

Pease just copy and paste this code and try.

Code: Select all | Expand

oMonitor2 := FW_GetMonitor( 2 )
DEFINE WINDOW oWnd FROM oMonitor2:Row(200), oMonitor2:Col(100) TO ;
   oMonitor2:Row(600),oMonitor2:Col(800) PIXEL
ACTIVATE WINDOW oWnd
 
This should work 100%.
After that you change the values as you like

Re: Two monitors, show different windows

Posted: Mon Oct 07, 2024 1:21 pm
by Adolfo
NAGES

Called from...
Local oMonitor2 := FW_GetMonitor( 2 )

DEFINE WINDOW oWnd2 FROM oMonitor2:Row(50), oMonitor2:Col(10) TO ;
oMonitor2:Row(700),oMonitor2:Col(900) PIXEL NOSYSMENU NOCAPTION



Thats how I use it... ther is no NROW in mi code

Re: Two monitors, show different windows

Posted: Mon Oct 07, 2024 1:25 pm
by Adolfo
Full code of my function


Function MuestraFoto(cTexto)
Local oBrush2
Local oWnd2
Local oMonitor2 := FW_GetMonitor( 2 )

DEFINE FONT oBold NAME 'Tahoma' SIZE 0, -320 BOLD
DEFINE BRUSH oBRush2 RESOURCE "LAYER" TILED

DEFINE WINDOW oWnd2 FROM oMonitor2:Row(50), oMonitor2:Col(10) TO ;
oMonitor2:Row(600),oMonitor2:Col(800) PIXEL NOSYSMENU NOCAPTION Brush oBrush2


@ nFil,nCol BITMAP oBmp FILENAME "test.png" OF oWnd2 NOBORDER PIXEL SIZE 800,800 ADJUST

oBmp:bPainted = { || SetBkMode( oBmp:hDC, 1 ),;
SetTextColor( obmp:hDC, CLR_WHITE ),;
oBold:Activate( oBmp:hDC ),;
TextOut( oBmp:hDC, 170, 30, cTexto ),;
oBold:DeActivate(oBmp:hDC) }

ACTIVATE WINDOW oWnd2

Return Nil

Re: Two monitors, show different windows

Posted: Mon Oct 07, 2024 4:54 pm
by nageswaragunupudi
I am extremely sorry.
The error is due to a bug in our TMonitor class.
And also thanks for bringing it to our notice.

Can you please apply the fix I am going to provide here and try it again?

\fwh\source\function\getsysin.prg
Please locate these two lines: (481,482)

Code: Select all | Expand

   METHOD Row( r )   INLINE ( ::nRow + r )
   METHOD Col( c )   INLINE ( ::nCol + c )
Please change them as:

Code: Select all | Expand

   METHOD Row( r )   INLINE ( ::nTop  + r )
   METHOD Col( c )   INLINE ( ::nLeft + c )
I tested with this change and it works.
Can you help us by implementing this fix and testing again?

Re: Two monitors, show different windows

Posted: Tue Oct 08, 2024 11:39 am
by Adolfo
Thanks Nages...

Works with no problems.

Thanks again

Re: Two monitors, show different windows

Posted: Wed Oct 09, 2024 3:01 am
by nageswaragunupudi
Please try this alternative approach also.
This may be simpler to code:

Code: Select all | Expand

local oMonitor2   := FW_GetMonitor( 2 )
local oWnd2

DEFINE WINDOW oWnd2 FROM 50,10 TO 600,800 PIXEL

// create your controls

ACTIVATE WINDOW oWnd2 ON INIT oMonitor2:Move( oWnd2 )
Your feedback helps us.

Re: Two monitors, show different windows

Posted: Thu Oct 10, 2024 8:16 am
by nageswaragunupudi
From the next version :

Code: Select all | Expand

ACTIVATE WINDOW [<clauses,...] IN nMonitor/oMonitor
ACTIVATE DIALOG [<clauses,...] IN oWnd/nMonitor/oMonitor