Menu Button Behavior
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Menu Button Behavior
Yes - within a container the calculations are wrong. We need to calculate the position relative to the group box then translate to the screen.
Here is an example.
Here is an example.
- Attachments
-
- Test-MenuB.psf
- (30.44 KiB) Downloaded 116 times
Re: Menu Button Behavior
Do I need to open a request/ticket elsewhere for this to be escalated for a fix?
Re: Menu Button Behavior
You can fix it yourself. Just make a new control set with the fixes.
I will post to Alex or Devon to have them look at this thread. Changing it may take some time. We willl have to let them decide. I am not a Sapien employee. THe people in this forum are all just community members.
I will post to Alex or Devon to have them look at this thread. Changing it may take some time. We willl have to let them decide. I am not a Sapien employee. THe people in this forum are all just community members.
Re: Menu Button Behavior
Re-creating the control set does not fix it. The issue remains.
Please let them know that.
Please let them know that.
Re: Menu Button Behavior
No. You have to create a new control set based on the old control set but with updated code. See the documentation on how to create custom control sets to learn how to do this.
Custom control sets are a feature of PSS that let use modify controls or define new control groups with code. The sets in PSS are mostly demos of what can be done or are just conveniences that Sapien has built over the years. They are fully modifiable. I currently have a number that are updates based on the original Sapien control.
This is how I patched the position.
You can change this to get the parent container on button initialization so that it always uses the containers position as the anchor.
Custom control sets are a feature of PSS that let use modify controls or define new control groups with code. The sets in PSS are mostly demos of what can be done or are just conveniences that Sapien has built over the years. They are fully modifiable. I currently have a number that are updates based on the original Sapien control.
This is how I patched the position.
- $menuButton2_Click={
- #Show the menu
- $point = New-Object System.Drawing.Point ($groupbox2.Location.X, $groupbox2.Bottom)
- $menuButtonContextmenustrip2.Show($form1.PointToScreen($point));
- }
Re: Menu Button Behavior
Here is the generic solution that will work in all versions of the control.
- $menuButton3_Click={
- #Show the menu
- $x = $this.Parent.Location.X + $this.Location.X + 10
- $y = $this.Parent.Location.Y + $this.Location.Y + 10
- $point = New-Object System.Drawing.Point ($x, $y)
- $menuButtonContextmenustrip3.Show($this.FindForm().PointToScreen($point));
- }
Re: Menu Button Behavior
Makes sense - I set the drawing point to the value I needed and it worked just fine.
Thanks
Thanks
Re: Menu Button Behavior
I had a bit of time to look at the best way to do this. If the control set uses the following line all will be well.
$menuButtonContextmenustrip1.Show($this.Parent.PointToScreen($point))
$menuButtonContextmenustrip1.Show($this.Parent.PointToScreen($point))