Para Antonio (Solved )

Para Antonio (Solved )

Postby lailton.webmaster » Mon Sep 14, 2009 5:07 am

Antonio,

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

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

Gracias
Last edited by lailton.webmaster on Thu Sep 17, 2009 11:41 pm, edited 1 time in total.
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Para Antonio

Postby Antonio Linares » Wed Sep 16, 2009 7: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: Select all  Expand view

// 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Para Antonio

Postby lailton.webmaster » Wed Sep 16, 2009 8: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
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Para Antonio

Postby lailton.webmaster » Wed Sep 16, 2009 8: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....

Image
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Para Antonio

Postby Antonio Linares » Wed Sep 16, 2009 10:06 am

Lailton,

Simply change this line :-)
Code: Select all  Expand view

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Para Antonio

Postby lailton.webmaster » Wed Sep 16, 2009 10:43 am

Antonio,

Perfect !!!!!!!! :lol:
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Para Antonio

Postby lailton.webmaster » Wed Sep 16, 2009 10:45 am

Antonio prova isso :D

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: Select all  Expand view

// 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)
 
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Para Antonio

Postby Antonio Linares » Wed Sep 16, 2009 1:03 pm

Here you have a working example:
http://www.mediafire.com/?sharekey=45bb ... c91101628c

Image

Code: Select all  Expand view

// 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Para Antonio

Postby lailton.webmaster » Wed Sep 16, 2009 6: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 ?
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Para Antonio

Postby lailton.webmaster » 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.
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Para Antonio

Postby lailton.webmaster » 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 ?
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Para Antonio

Postby Antonio Linares » Thu Sep 17, 2009 3:33 am

Lailton,

Posiblemente falte capturar el ratón. Prueba asi:
Code: Select all  Expand view

   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
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Para Antonio

Postby lailton.webmaster » Thu Sep 17, 2009 5:04 am

Antonio,

Ainda continua com o problema, quando movo a tela rapidamente os cantos do bitmaps fica piscando...
Last edited by lailton.webmaster on Thu Sep 17, 2009 11:37 pm, edited 1 time in total.
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Para Antonio

Postby Antonio Linares » Thu Sep 17, 2009 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Para Antonio

Postby lailton.webmaster » Thu Sep 17, 2009 5:31 pm

:lol:

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:
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Willi Quintana and 39 guests