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
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
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
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
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 ![]()
#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// 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 nilThanks 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.
The moving window can paint the bitmap on its own surface. Its simple.
I make a try and I have the same value :
oSprite is the bitmap
oSprite:bMoved := { | nRow, nCol | msginfo(oRbar:nheight,oSprite:nTop) }
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()
#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