FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Para Antonio (Solved )
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Para Antonio (Solved )
Posted: Mon Sep 14, 2009 05:07 AM
Antonio,

Já es possivel fazer isso usando fivewin sem libs adicionais ?

Veja aqui; http://www.redstarsoft.com.br/sample.rar

Gracias
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Para Antonio
Posted: Wed Sep 16, 2009 07:51 AM
Lailton,

Sí. Primero como diseñar una ventana que se pueda mover y que no muestre nada propio de Windows:
FWH\samples\TestMMov.prg
Code (fw): Select all Collapse
// Moving a window, with the mouse, without a caption

#include "FiveWin.ch"

function Main()

   local oWnd, nRowPos, nColPos, lDrag := .F., oCrsHand

   DEFINE CURSOR oCrsHand HAND

   DEFINE WINDOW oWnd STYLE WS_POPUP COLOR "W/R"

   oWnd:bLClicked := { | nRow, nCol | nRowPos := nRow, nColPos := nCol, lDrag := .T., oWnd:oCursor := oCrsHand }
      
   oWnd:bMMoved = { | nRow, nCol | If( lDrag, oWnd:Move( oWnd:nTop + nRow - nRowPos,;
                                         oWnd:nLeft + nCol - nColPos ),) }   

   oWnd:bLButtonUp := { || lDrag := .F., oWnd:oCursor := nil }

   ACTIVATE WINDOW oWnd

return nil

La segunda parte es mostrar un dibujo sobre la ventana y esta hacerla transparente:
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Para Antonio
Posted: Wed Sep 16, 2009 08:05 AM

Antonio,

isso nao trabalha pra mim no win XP ( FWH 902 ).

quando movo a tela ela se perde nas outras telas tenho que passar outra tela por cima
dela para ela aparcer certo novamente...

outra pergunta.

e como fazer para pegar a regiao q recebeu o click: exemplo odlg quero q pegue o click na top 10 left 10 to boot 20 right 20
tem como capturar o click dentro dessa regiao ?

gracias

Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Para Antonio
Posted: Wed Sep 16, 2009 08:13 AM
Image do problema que ocorre com a tela,

tentei usar o Ownd:Refresh() no method paint do windows para ver se resolvia
mais continua do mesmo jeito....

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Para Antonio
Posted: Wed Sep 16, 2009 10:06 AM
Lailton,

Simply change this line :-)
Code (fw): Select all Collapse
   oWnd:bMMoved = { | nRow, nCol | If( lDrag, oWnd:Move( oWnd:nTop + nRow - nRowPos,;
                                         oWnd:nLeft + nCol - nColPos,,, .T. ),) }
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Para Antonio
Posted: Wed Sep 16, 2009 10:43 AM

Antonio,

Perfect !!!!!!!! :lol:

Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Para Antonio
Posted: Wed Sep 16, 2009 10:45 AM
Antonio prova isso :-)

y tu pode ajudar ahora con lo BMP de fundo ? con la transparencia fazendo ficar en lo formato do BMP ?
yo vi lo sample NEWHELP pero no consegui deixar igual a DRzwin.

Gracias.

Code (fw): Select all Collapse
// Moving a window, with the mouse, without a caption
#include "FiveWin.ch"
function Main()
   local oWnd, nRowPos, nColPos, lDrag := .F., oCrsHand
   DEFINE CURSOR oCrsHand HAND
   lRECT:=lRectWIN():new()
   lRECT:AddRect( 0, 0,100,100, {|| MsgInfo("Dentro","Inside") } )
   DEFINE WINDOW oWnd STYLE WS_POPUP COLOR CLR_WHITE, CLR_BLUE
   oWnd:bLClicked := { | nRow, nCol |  iif(lRECT:Check(nRow, nCol),nil,( nRowPos := nRow, nColPos := nCol, lDrag := .T., oWnd:oCursor := oCrsHand) )}
   oWnd:bMMoved = { | nRow, nCol | If( lDrag, oWnd:Move( oWnd:nTop + nRow - nRowPos, oWnd:nLeft + nCol - nColPos,,, .T. ),) } 
   oWnd:bLButtonUp := { || lDrag := .F., oWnd:oCursor := nil }
   ACTIVATE WINDOW oWnd on paint(areal(oWNd))
return nil

function areal(lWin)
 // quadrado marcando o local onde o click sera capturado
 RoundRect( lWin:hDC, 0 , 0 , 100, 100, 0, 0)
return 

Class lRecTWIN
      data xWin
      data aRec
      method New() constructor
      method AddRect(nTop, nLeft, nBottom, nRight, bAction) INLINE AAdd(::aRec, {nTop,nLeft,nBottom,nRight, bAction}) 
      method Check()
endclass 

method New() class lRectWIN
       ::arec:={}
return self

method Check(x,y) CLASS lRectWIN
local ret:=.f.
       for n = 1 to len(::aRec)
           if (x>::aRec[n][1] .and. y>::aRec[n][2] .and. x<::aRec[n][3] .and. y<::aRec[n][4])
              if (::aRec[n][5]<>Nil)
                      eVal(::aRec[n][5])
              endif
              ret:=.t.
           endif
       next n 
return(ret)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Para Antonio
Posted: Wed Sep 16, 2009 01:03 PM
Here you have a working example:
http://www.mediafire.com/?sharekey=45bb ... c91101628c



Code (fw): Select all Collapse
// Moving a window, with the mouse, without a caption

#include "FiveWin.ch"

function Main()

   local oWnd, nRowPos, nColPos, lDrag := .F., oCrsHand, oBmp

   DEFINE CURSOR oCrsHand HAND

   DEFINE BITMAP oBmp FILENAME "test.bmp"

   DEFINE WINDOW oWnd STYLE WS_POPUP COLOR "W/R"

   oWnd:bLClicked := { | nRow, nCol | nRowPos := nRow, nColPos := nCol, lDrag := .T., oWnd:oCursor := oCrsHand }
      
   oWnd:bMMoved = { | nRow, nCol | If( lDrag, oWnd:Move( oWnd:nTop + nRow - nRowPos,;
                                         oWnd:nLeft + nCol - nColPos,,, .T. ),) }   

   oWnd:bLButtonUp := { || lDrag := .F., oWnd:oCursor := nil }

   oWnd:SetSize( 221, 221 )
   oWnd:Center()

   ACTIVATE WINDOW oWnd ;
      ON INIT  SetTransparent( oWnd ) ; 
      ON PAINT PaintTransparent( hDC, oBmp:hBitmap, 0, 0 ) ;
      ON RIGHT CLICK oWnd:End()

   oBmp:End()

return nil

#define LWA_COLORKEY  1 
#define GWL_EXSTYLE   -20 
#define WS_EX_LAYERED 524288 

STATIC FUNCTION SETTRANSPARENT( oDlg ) 

   SETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE, NOR( GETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) ) 

   SETLAYEREDWINDOWATTRIBUTES( oDlg:hWnd, CLR_RED,, LWA_COLORKEY ) 

RETURN NIL

function PaintTransparent( hDC, hBitmap, nRow, nCol )

   local hBmpOld := SelectObject( hDC, hBitmap )
   local nZeroZeroClr := GetPixel( hDC, 0, 0 )
   local nOldClr 

   SelectObject( hDC, hBmpOld )
   nOldClr = SetBkColor( hDC, nRGB( 255, 255, 255 ) )
   TransBmp( hBitmap, nBmpWidth( hBitmap ), nBmpHeight( hBitmap ),;
             nZeroZeroClr, hDC, nRow, nCol, nBmpWidth( hBitmap ), nBmpHeight( hBitmap ) )
   SetBkColor( hDC, nOldClr )          

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Para Antonio
Posted: Wed Sep 16, 2009 06:10 PM

Antonio,

Quando eu movo a janela que esta com BMP fica lento a janela. e o Drzwin o exe funciona bem
movo a janela e o bmp acompanha sem ficar tremendo na tela.

pq sera ?

Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Para Antonio
Posted: Wed Sep 16, 2009 11:02 PM
Antonio,

prova isso :
http://www.redstarsoft.com.br/test2.rar

note que con la drzwin a tela no fica tremida quando yo movo, pero da forma que me passaste as peradas
da janelas fic piscando quando eu movo muito rapido na tela.

tien como solver isto ?

gracias.
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Para Antonio
Posted: Wed Sep 16, 2009 11:36 PM

YO tentei hacer un vido con cantasia estudio para mostrar lo problema em lo movimento pero no sei porque
esto criado no fivewin no aparece na gravacao :( y o que usa DrzWin aparece :( coisa de loco em ???hehehe

Antonio tien alguna sugestion ?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Para Antonio
Posted: Thu Sep 17, 2009 03:33 AM
Lailton,

Posiblemente falte capturar el ratón. Prueba asi:
Code (fw): Select all Collapse
   oWnd:bLClicked := { | nRow, nCol | SetCapture( oWnd:hWnd ), nRowPos := nRow, nColPos := nCol, lDrag := .T.,;      
                                                         oWnd:oCursor := oCrsHand }
   ...
   oWnd:bLButtonUp := { || lDrag := .F., oWnd:oCursor := nil, ReleaseCapture() }
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Para Antonio
Posted: Thu Sep 17, 2009 05:04 AM

Antonio,

Ainda continua com o problema, quando movo a tela rapidamente os cantos do bitmaps fica piscando...

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Para Antonio
Posted: Thu Sep 17, 2009 05:22 AM

Lailton,

Why do you need to move it so fast ?

Are you building a video game ? :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Para Antonio
Posted: Thu Sep 17, 2009 05:31 PM

hehehehhehe

No,

i will make a control for socket + biometric SDK griaule.

and i like of use it, more when move stay bad of screen,
i want use without lib of other people, and think that other people too have interesse in use it
so think that is good that fivewin native of support to this.

you think that can solve it ?

Thanks so much for your atencion.

y Antonio,
Quem sabe depois podemos hacer un FiveWinGAME
hehehehe :lol:

:lol: