Page 1 of 1

Ribbon Limit ---- RESOLVED!!!

PostPosted: Tue Jan 19, 2010 11:00 am
by MdaSolution
I want move a bitmap with ldrag procedure into a Main ownd but I want not move over the ribbonbar

How I can make it ?

thanks

Re: Ribbon Limit

PostPosted: Fri Jan 22, 2010 6:03 pm
by MdaSolution
Any Idea ?

I want the user can move a bitmap only on the child window and not move the bitmap over the ribbon or near to border of child window

Re: Ribbon Limit

PostPosted: Fri Jan 22, 2010 7:35 pm
by Antonio Linares
You could use Windows function ClipCursor() to confine the cursor to a rectangular area on the screen:

http://msdn.microsoft.com/en-us/library/ms648383(VS.85).aspx

Example:
http://msdn.microsoft.com/en-us/library/ms648380(VS.85).aspx
look for "Confining a Cursor"

Re: Ribbon Limit

PostPosted: Fri Jan 22, 2010 7:51 pm
by MdaSolution
thanks Antonio,
But with fivewin we not have any function to set it ?
I use this code to move the bitmaps

@ nRow, nCol BITMAP oSprite;
RESOURCE cBitmap;
PIXEL NOBORDER of oWnd


oSprite:lTransparent = .T.
oSprite:Move(oSprite:nTop,;
oSprite:nLeft,;
,;
)


oSprite:lDrag := .T.

oSprite:bMoved := {|| oSprite:CoorsUpdate() ,;
nBmpRow := oSprite:nTop ,;
nBmpCol := oSprite:nLeft ;
}





and I wish move the bitmaps not over the ribbon

Re: Ribbon Limit

PostPosted: Fri Jan 22, 2010 8:03 pm
by MdaSolution
Antonio,

I found on xharbour.com guide

MSetBounds( [<nTop>], [<nLeft>], [<nBottom>], [<nRight>] ) --> NIL
Arguments
<nTop>
A numeric value indicating the screen coordinate for the top boundary of the restricting rectangle. The default value is 0.
<nLeft>
A numeric value indicating the screen coordinate for the left boundary of the restricting rectangle. The default value is 0.
<nBottom>
A numeric value indicating the screen coordinate for the bottm boundary of the restricting rectangle. The default value is MaxRow().
<nRight>
A numeric value indicating the screen coordinate for the right boundary of the restricting rectangle. The default value is MaxCol(). Return
The function always returns NIL.
Description
The function restricts mouse cursor movement to the rectangle defined with the passed parameters. If no parameter is passed to MSetBounds(), the function releases all boundaries set. MSetBound() is a compatibility function for text mode and full screen applications.
Info
See also: MPresent(), MRestState(), MSaveState(), MSetCursor()
Category: Mouse functions
Source: rtl\mouseapi.c
LIB: xhb.lib
DLL: xhbdll.dll





but I not Know if we can use on xfwh this function and if this function can be usefull to resolve the problem

Re: Ribbon Limit

PostPosted: Fri Jan 22, 2010 8:17 pm
by Antonio Linares
Domenico, (?)

MSetBounds() seems to be for text mode applications and probably it will not work for GUI apps.

Please provide a more complete example using oSprite so we can understand what you want to do and we can provide you a better help, thanks :-)

Re: Ribbon Limit

PostPosted: Fri Jan 22, 2010 10:49 pm
by MdaSolution
Antonio,

(?) Yo y mi amigo que usted sabe que estamos trabajando juntos en otro proyecto para un restaurante

También hemos usado ese MdaSolution cuenta que es mi empresa italiana

Traté de hacer una pequeña prueba para que usted trate de resolver el problema

Cuando se mueve el bitmap que se oculta bajo el ribbon


Code: Select all  Expand view


#include "fivewin.ch"
#include "ribbon.ch"


#define GRID_X    10
#define GRID_Y    10

static oWnd



function main()
   Local nItem
   Local oRBar
   Local  oMenu
   Local oGr1, oGr2, oGr3, oGr4  //GROUPS FOR RIBBON
   Local oBtn[30]

   DEFINE WINDOW oWnd TITLE "sala de ventas"  from 1,1 to 600,600 pixel //brush oBrush1

   DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "Objectos" HEIGHT 180 TOPMARGIN 55

    ADD GROUP oGr1 RIBBON oRBar TO OPTION 1 PROMPT "Acciones" width 120
     @ 2,5 ADD BUTTON oBtn[1] PROMPT "Grabar" BITMAP "Save.bmp"     GROUP oGr1  ROUND SIZE 50,65   action SAVE()
     @ 2, 55 ADD BUTTON oBtn[2] PROMPT "SAlir"  BITMAP "exit.bmp" GROUP oGr1 ROUND SIZE 50,65  action oWnd:end()



   //  ADD SEPARATOR TO GROUP oGr2 COL 235

 ADD GROUP oGr2 RIBBON oRBar TO OPTION 1 PROMPT "cancellare" width 150
     @ 2, 5  ADD BUTTON oBtn[3] PROMPT "Quitar seleccìon"  BITMAP "quitar.bmp"    GROUP oGr2 ROUND SIZE 100,75 ACTION (nItem :=0)




ADD GROUP oGr3 RIBBON oRBar TO OPTION 1 PROMPT "Mesas" WIDTH 360
 @ 2, 5   ADD BUTTON oBtn[10]   BITMAP "mesas.bmp"     GROUP oGr3  ROUND SIZE 50,75 ACTION (nItem :=7)




 SET MESSAGE OF oWnd TO "Disenando sala de ventas" ;
    CENTERED CLOCK KEYBOARD 2007


 oWnd:bLClicked    = { | nRow, nCol, nFlags | create_object(nItem, nRow,nCol) }

 SetGridSize( 1, 1 )   //I use  this  to design easy each object

        ACTIVATE WINDOW oWnd   ;
        ON PAINT DrawGrid( oWnd:hWnd, hDC, cPS, GRID_X, GRID_Y )

   oRBar:End()

   return nil


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

Function create_object(nItem, nRow,nCol)
   Local oSprite
   Local cBitmap:=""


 DO CASE
 CASE nItem = 7
        cBitmap="mesas.bmp"


     CASE nItem = 0
             return nil
  ENDCASE


 @ nRow, nCol BITMAP oSprite;
              RESOURCE cBitmap;
              PIXEL NOBORDER  of oWnd      // SIZE 64,64

   nTipo:=nItem

   oSprite:lTransparent = .T.

   //TO MOVE

   /* oSprite:Move(oSprite:nTop,;   this make error
                  oSprite:nLeft,;
                  oSprite:nWidth,;
                  oSprite:nHeight) */


       oSprite:Move(oSprite:nTop,;
                  oSprite:nLeft,;
                  ,;
                  )


     oSprite:HideDots()

     oSprite:lDrag  := .T.

     oSprite:bMoved := {|| oSprite:CoorsUpdate()      ,;
                           nBmpRow := oSprite:nTop  ,;
                           nBmpCol := oSprite:nLeft ;
                         }

     oSprite:cargo := {cBitmap,nType }
 
     oSprite:bRClicked = { | nRow, nCol | menu_action( oSprite, nRow, nCol ) }


     oSprite:SetFocus()

  return nil


function  menu_action( oSprite, nRow, nCol )
   local oMenu
   MENU oMenu POPUP  2007
      MENUITEM "&Cancel object"  action delImg( oSprite,oWnd)
        ENDMENU
   ACTIVATE MENU oMenu AT nRow, nCol OF oSprite
return nil



Function   delImg(oSprite,oWnd)
   if MsgYesNo( "Delete this symbol ?" )
     oSprite:End()
   ENDIF
   oWnd:refresh()
   return NIL


FUNCTION SAVE()

//grabar


return NIL



 

Re: Ribbon Limit

PostPosted: Sat Jan 23, 2010 10:11 am
by Antonio Linares
When you use the DATA lDrag, the bitmap can be moved over all its container surface.

Instead of using lDrag, it may be better to use a non caption and non border window, and move it, so you can supervise and control its coordinates:

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,,, .T. ),) }  

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

   ACTIVATE WINDOW oWnd

return nil
 

Re: Ribbon Limit

PostPosted: Sat Jan 23, 2010 11:22 am
by MdaSolution
Thanks Maestro,
But I have a bitmap to move into a ownd with ribbon control and I must not move a window on the screen.
I need it to create a plan of the room of restaurant, to set the tables.

Re: Ribbon Limit

PostPosted: Sat Jan 23, 2010 12:50 pm
by Antonio Linares
The moving window can paint the bitmap on its own surface. Its simple.

Re: Ribbon Limit

PostPosted: Sat Jan 23, 2010 3:44 pm
by MdaSolution
I make a try and I have the same value :

oSprite is the bitmap

oSprite:bMoved := { | nRow, nCol | msginfo(oRbar:nheight,oSprite:nTop) }

Re: Ribbon Limit

PostPosted: Mon Jan 25, 2010 11:12 am
by MdaSolution
Mr Antonio,
I can call clipcursor function ?

DllImport("user32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)>
Public Shared Function ClipCursor(ByRef rcClip As RECT) As BooleanEnd Function

I found on foxpro
DECLARE SHORT ClipCursor IN user32 STRING lpRect
http://www.news2news.com/vfp/?example=8 ... 75db2bf140

and in vb6

Declare Function ClipCursor Lib "user32.dll" (lpRect As RECT) As Long


on fwh We can try

Arect:= GetWindowRect(odlg:hwn)
clipcursor(Arect)

but I not Know How call this function



BUT It seem there is a function on c++ called clipcursor()

Re: Ribbon Limit

PostPosted: Mon Jan 25, 2010 11:41 am
by MdaSolution
FOUND !!!!!!!!!!!

Code: Select all  Expand view

#include "fivewin.ch"

*************
function MAIN
*************

local oDlg

define dialog oDlg from 0, 0 to 400, 600 pixel

* Posiciona o cursor do mouse
@10, 10 button "Posicionar" of oDlg action setcursorpos( 200, 300 )     pixel

* Mostra o Mouse na Tela
@30, 10 button "Mostar"     of oDlg action SHOW_MOUSE()                 pixel

* Esconde o Mouse nesta Dialog
@50, 10 button "Esconder"   of oDlg action HIDE_MOUSE()                 pixel

* Confina o Mouse em uma certa posicao da tela
@70, 10 button "Confinar"   of oDlg action clipcursor( 10, 10, 10, 10 ) pixel

* Confina o Mouse em uma certa posicao da tela
@90, 10 button "Sair Confinamento" of oDlg ;
        action ( clipcursor( 0, 0, 800, 600 ), setcursorpos( 400, 300 ) ) pixel

activate dialog oDlg centered

return NIL

*******************
function HIDE_MOUSE
*******************

local ST_CUR

do while .T.
   ST_CUR := ShowCursor( 0 )
   if ST_CUR < 0        &&  Enquanto o Status do ponteiro nao for Menor que Zero
      exit
   endif
enddo

return NIL

*******************
function SHOW_MOUSE
*******************

local ST_CUR

do while .T.
   ST_CUR := ShowCursor( 1 )
   if ST_CUR >= 0       &&  Enquanto o Status do ponteiro for Maior ou igual a Zero
      exit
   endif
enddo

return NIL

#pragma BEGINDUMP

#include "windows.h"
#include "hbapi.h"

HB_FUNC( CLIPCURSOR )
{
     RECT rct;

     rct.left = hb_parnl( 1 );
     rct.top = hb_parnl( 2 );
     rct.right = hb_parnl( 3 );
     rct.bottom = hb_parnl( 4 );

     hb_retl( ClipCursor( &rct ) );
}

#pragma ENDDUMP