Object on Form can be move by user
Moderator: Rathinagiri
Re: Object on Form can be move by user
Includedmol wrote:you've missed IDE.PRG in attached sample
- Attachments
-
- demo.rar
- (10.93 KiB) Downloaded 212 times
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG
-
Javier Tovar
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: Object on Form can be move by user
Hola bpd2000,
Pues si esta excelente la aplicación
, pero no creo poder ayudar,
, todavia mis conocimientos son escasos!
Pero seria buena aplicación.
Saludos
Pues si esta excelente la aplicación
Pero seria buena aplicación.
Saludos
Re: Object on Form can be move by user
Some years ago Roberto decided to not publish IDE code...bpd2000 wrote:Dear Javier Tovar,
Thank you for code
I have created attached sample code that can be compile in minigui
I want same code to compile in HMG
Any help
Re: Object on Form can be move by user
Try this sample, you can remove msgdebug mesages...
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library Demo
* bpd2000@gmail.com
*/
/* modified by Marek Olszewski MOL (2014.04.17)
* mol@pro.onet.pl
*/
#include "minigui.ch"
function main
Define window oEdit At 0,0 width 600 height 400 main title "Move & Resize Control?"
// Public nTextBoxCounter := 0
Public nTitleBarHeight := GetTitleHeight()
Public nBorderWidth := GetBorderWidth()
DEFINE STATUSBAR Font "Arial" SIZE 8
STATUSITEM ""
END STATUSBAR
DEFINE button moveControl1
Row 120
Col 15
width 80
caption "Move_Me"
action moveControl( this.name )
END button
/*
DEFINE button resizeControl1
Row 120
Col 115
width 100
caption "Resize_Me"
action resizeControl( _HMG_aControlNames[ 1 ] )
END button
*/
End window
oEdit.center
oEdit.activate
return nil
************************************
PROCEDURE MoveControl( cControlName )
LOCAL ControlHandle := GetControlHandle( cControlName, 'oEdit' )
LOCAL z
ControlHandle := GetControlHandle(cControlName, thisWindow.Name)
nCurrentCol := this.Col //- oEdit.Col - nBorderWidth
nCurrentRow := this.Row //- oEdit.Row - nTitleBarHeight - nBorderWidth
msgdebug(nCurrentCol, nCurrentRow)
InterActiveMove()
nCurrentCol := GetWindowCol( ControlHandle ) - oEdit.Col - nBorderWidth
nCurrentRow := GetWindowrow( ControlHandle ) - oEdit.Row - nTitleBarHeight - nBorderWidth
msgdebug(nCurrentCol, nCurrentRow)
nCurrentCol := int(nCurrentCol / 10) * 10
nCurrentRow := int(nCurrentRow / 10) * 10
this.col := nCurrentCol
this.row := nCurrentRow
RETURN
*******************************************************
PROCEDURE DrawFocusRect( oControl )
//ERASE WINDOW oEdit
//DRAW RECTANGLE IN WINDOW oEdit AT oEdit.&(oControl).row - 1 , oEdit.&(oControl).col - 1 TO oEdit.&(oControl).row + oEdit.&(oControl).height + 1 , oEdit.&(oControl).col + oEdit.&(oControl).width + 1 PENCOLOR { 128, 128, 128 } PENWIDTH 2
//DRAW RECTANGLE IN WINDOW oEdit AT oEdit.&(oControl).row + oEdit.&(oControl).height + 2 , oEdit.&(oControl).col + oEdit.&(oControl).width + 2 TO oEdit.&(oControl).row + oEdit.&(oControl).height - 6 , oEdit.&(oControl).col + oEdit.&(oControl).width - 6 PENCOLOR { 128, 128, 128 } PENWIDTH 2 FILLCOLOR {192,192,192}
RETURN
*******************************************************
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
HB_FUNC( SETPIXEL )
{
hb_retnl( (ULONG) SetPixel( (HDC) hb_parnl( 1 ) ,
hb_parni( 2 ) ,
hb_parni( 3 ) ,
(COLORREF) hb_parnl( 4 ) ) );
}
HB_FUNC( SETCROSSCURSOR )
{
SetClassLong( ( HWND ) hb_parnl(1), GCL_HCURSOR, ( LONG ) LoadCursor(NULL, IDC_CROSS) );
}
HB_FUNC( INTERACTIVEMOVE )
{
keybd_event(
VK_RIGHT, // virtual-key code
0, // hardware scan code
0, // flags specifying various function options
0 // additional data associated with keystroke
);
keybd_event(
VK_LEFT, // virtual-key code
0, // hardware scan code
0, // flags specifying various function options
0 // additional data associated with keystroke
);
SendMessage( GetFocus(), WM_SYSCOMMAND, SC_MOVE, 10 );
RedrawWindow( GetFocus(), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASENOW | RDW_UPDATENOW );
}
HB_FUNC( INTERACTIVESIZE )
{
keybd_event(
VK_DOWN,
0,
0,
0
);
keybd_event(
VK_RIGHT,
0,
0,
0
);
SendMessage( GetFocus(), WM_SYSCOMMAND, SC_SIZE, 0 );
}
#pragma ENDDUMP
Re: Object on Form can be move by user
Thank you, Molmol wrote:Try this sample, you can remove msgdebug mesages...
Excellent coding extension
Regarding re-size of Object, Hint
With the use of Move & Re-size of object we can design application to Crop Image etc.
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG
Re: Object on Form can be move by user
You request, you get it!
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library Demo
* bpd2000@gmail.com
*/
#include "minigui.ch"
FUNCTION MAIN
Define window oEdit At 0,0 width 600 height 400 main title "Move & Resize Control?"
Public nTitleBarHeight := GetTitleHeight()
Public nBorderWidth := GetBorderWidth()
DEFINE STATUSBAR Font "Arial" SIZE 8
STATUSITEM ""
END STATUSBAR
DEFINE button MoveControl1
Row 120
Col 15
width 120
height 30
caption "TEST BUTTON"
action MsgBox( "Call context menu of this button to move or resize control" )
END button
DEFINE CONTROL CONTEXTMENU MoveControl1
MenuItem "Move button" action moveControl( "MoveControl1" )
MenuItem "Resize button" action ResizeControl( "MoveControl1" )
END MENU
End window
oEdit.center
oEdit.activate
return nil
************************************
PROCEDURE MoveControl( cControlName )
LOCAL ControlHandle
DoMethod(ThisWindow.Name, cControlName, "SetFocus")
ControlHandle := GetControlHandle(cControlName, thisWindow.Name)
InterActiveMove()
nCurrentCol := GetWindowCol( ControlHandle ) - oEdit.Col - nBorderWidth
nCurrentRow := GetWindowrow( ControlHandle ) - oEdit.Row - nTitleBarHeight - nBorderWidth
//nCurrentCol := int(nCurrentCol / 10) * 10
//nCurrentRow := int(nCurrentRow / 10) * 10
SetProperty(ThisWindow.Name, cControlName,"Col", nCurrentCol)
SetProperty(ThisWindow.Name, cControlName,"Row", nCurrentRow)
RETURN
/*----------------------------------------------------------------------*/
PROCEDURE ResizeControl( cControlName )
LOCAL ControlHandle := GetControlHandle( cControlName, 'oEdit' )
local nNewWidth, nNewHeight
DoMethod(ThisWindow.Name, cControlName, "SetFocus")
ControlHandle := GetControlHandle(cControlName, thisWindow.Name)
InterActiveSize()
nNewWidth := GetWindowWidth( ControlHandle )
nNewHeight := GetWindowHeight( ControlHandle )
SetProperty(ThisWindow.Name, cControlName,"Width",nNewWidth)
SetProperty(ThisWindow.Name, cControlName,"Height", nNewHeight )
RETURN
/*----------------------------------------------------------------------*/
*******************************************************
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
HB_FUNC( SETPIXEL )
{
hb_retnl( (ULONG) SetPixel( (HDC) hb_parnl( 1 ) ,
hb_parni( 2 ) ,
hb_parni( 3 ) ,
(COLORREF) hb_parnl( 4 ) ) );
}
HB_FUNC( SETCROSSCURSOR )
{
SetClassLong( ( HWND ) hb_parnl(1), GCL_HCURSOR, ( LONG ) LoadCursor(NULL, IDC_CROSS) );
}
HB_FUNC( INTERACTIVEMOVE )
{
keybd_event(
VK_RIGHT, // virtual-key code
0, // hardware scan code
0, // flags specifying various function options
0 // additional data associated with keystroke
);
keybd_event(
VK_LEFT, // virtual-key code
0, // hardware scan code
0, // flags specifying various function options
0 // additional data associated with keystroke
);
SendMessage( GetFocus(), WM_SYSCOMMAND, SC_MOVE, 10 );
RedrawWindow( GetFocus(), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASENOW | RDW_UPDATENOW );
}
HB_FUNC( INTERACTIVESIZE )
{
keybd_event(
VK_DOWN,
0,
0,
0
);
keybd_event(
VK_RIGHT,
0,
0,
0
);
SendMessage( GetFocus(), WM_SYSCOMMAND, SC_SIZE, 0 );
}
#pragma ENDDUMP
Re: Object on Form can be move by user
Thank you, Molmol wrote:You request, you get it!
Very nice coding and useful to other user also
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG
-
Javier Tovar
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: Object on Form can be move by user
mol wrote:You request, you get it!
Gracias Mol, en verdad Felicidades!!!
Buena aplicación,
Saludos