|
| What command to use to allow controls to move around |
| Iniciado por guest, 16,sep. 2010 09:16 - 5 respuestas |
| |
| | | |
|
| |
| Publicado el 16,septiembre 2010 - 09:16 |
Hi, What command in windev to allow the end user to move the controls (eg. button ) around in the window screen? for example. i've a group of buttons which enduser can click and drag it around the screen ( within the same window ). Any sample codes will be nice  Regards, PETER ZHOU |
| |
| |
| | | |
|
| | |
| |
| Publicado el 16,septiembre 2010 - 15:52 |
Hello Peter I don't think there is any command to do that but if you had a datafile set up to hold the formname and a linked file to hold the control names and their x,y locations, you could create a process to allow the user to click on the control they want to move and move the mouse to the new position and register the x,y position for a left mouse down on the screen. You could then save the new x,y position to the link file and move the control to the new position. Whenever you open a form, you could search the datafile for the formname and move the controls to their user assigned positions that have been recorded in the link file. I would build the window off screen and then move the window onto its normal screen position Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 16,septiembre 2010 - 16:00 |
| al's solution is ok but to move all the controls at the same time put then inside a supercontrol and play with supercontrol_name..x / supercontrol_name..y |
| |
| |
| | | |
|
| | |
| |
| Publicado el 16,septiembre 2010 - 18:10 |
Hi Peter, I use some slightly adapted code from a old Windev example that can drag and drop an image control. Perhaps it works on buttons too.
ST_Drag is structure nXInitis int nYInitis int nXPosis int nYPosis int sControl is string END Drag_Img is ST_Drag
Event("Drag","",513) Event("Drag","*.",512) Event("Drag","*.",514) Procedure Drag() nEventNum is int nNewNr,nXPos,nYPos are int nEventNum=_EVE.wMessage IF nEventNumQ3 THEN Drag_Img:sControl=ControlOver(True, True)
IF Left(Drag_Img:sControl,2)="LL" THEN
CallDLL32("User32", "SetCapture", Handle(""))
Drag_Img:nXInit=LoWord(_EVE.lParam) Drag_Img:nYInit=HiWord(_EVE.lParam) Drag_Img:nXPos={Drag_Img:sControl,indControl}..X Drag_Img:nYPos={Drag_Img:sControl,indControl}..Y Drag_Img:nCurNr=Val(ExtractString(Drag_Img:sControl,2,"_")) ELSE Drag_Img:sControl="" END ELSE IF nEventNumQ2 THEN
IF Drag_Img:sControl"" THEN
nXPos=Drag_Img:nXPos+(LoWord(_EVE.lParam)-Drag_Img:nXInit) nYPos=Drag_Img:nYPos+(HiWord(_EVE.lParam)-Drag_Img:nYInit)
IF nXPos={Drag_Img:sControl,indControl}..X AND nYPos={Drag_Img:sControl,indControl}..Y THEN RETURN END
IF nXPoswin_KlasPlan..Width-20 THEN nXPos=win_KlasPlan..Width-{Drag_Img:sControl,indControl}..Width-20 END END IF nYPoswin_KlasPlan..Height-28 THEN nYPos=win_KlasPlan..Height-{Drag_Img:sControl,indControl}..Height-28 END END
{Drag_Img:sControl,indControl}..X=nXPos {Drag_Img:sControl,indControl}..Y=nYPos
END ELSE IF nEventNumQ4 THEN
IF Drag_Img:sControl"" THEN CallDLL32("User32", "ReleaseCapture")
nXPos=Drag_Img:nXPos+(LoWord(_EVE.lParam)-Drag_Img:nXInit) nYPos=Drag_Img:nYPos+(HiWord(_EVE.lParam)-Drag_Img:nYInit) {Drag_Img:sControl,indControl}..X=Drag_Img:nXPos {Drag_Img:sControl,indControl}..Y=Drag_Img:nYPos Drag_Img:sControl="" END END Might be useful. I'm curious if it works for buttons too. Regards, Piet |
| |
| |
| | | |
|
| | |
| |
| Publicado el 20,septiembre 2010 - 11:31 |
Why don't you use the toolbar control ? Regards Ab |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,mayo 2018 - 16:13 |
| Hi, i was looking to your code for moving images, you are using variables nEventNumQ3, nEventNumQ2 etc. these are not defined in the code. can you tell me its data type? and there are 2 windows as i understand. win_KlasPlan and nXPoswin_KlasPlan, can you tell me what the 2nd one is? |
| |
| |
| | | |
|
| | | | |
| | |
|