{Solved} Allow a user to move a control and right click
Posted
#1
(In Topic #1153)
Enthusiast

1.. is it possible to allow a user to drag a control around my program screen and allow the control to be moved there?
2.. If I put a right click or context menu on a group of controls how can I tell which control spawned the right click menu?
Posted
Regular

If by "screen" you mean the Container, where the Control is located, you can simply use the "Drag&Drop":sadams54 said
1.. is it possible to allow a user to drag a control around my program screen and allow the control to be moved there?
Code (gambas)
- Label1.Background = Color.Red
- Label1.Drag("")
- ' When moving the "Label", the mouse pointer remains at the point in the "Label" where you clicked:
- With Label1
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Guru

To move controls… (alternative)
Code (gambas)
If the container has Arrangement set it will try to place the controls itself and not let you do it.
Posted
Guru

1.. is it possible to allow a user to drag a control around my program screen and allow the control to be moved there?
Here is some example code you can run in a Graphical Program that will show you how to do this.
2.. If I put a right click or context menu on a group of controls how can I tell which control spawned the right click menu?
I have added a menu so you can test this. The Last command will tell you what the control was. Look at the program Title as you click on each control.
Code (gambas)
- hPictureBox As PictureBox
- SetUpMenu
- .W = 800
- .H = 500
- .Arrangement = Arrange.None
- .Background = Color.Red
- .h = 128
- .w = 128
- .x = 20 + (iLoop * 150)
- .y = 20 + (iLoop * 150)
- .PopupMenu = "hMenu"
- hMenu.Hide
- hMenuItem.text = sTemp
Posted
Enthusiast

Posted
Regular

…infact cogier showed another way to move the Controls.vuott said
Actually, you could drag a Control without the Drag&Drop…
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Enthusiast

1 guest and 0 members have just viewed this.


