Print Page | Close Window

What's the best way to delete a grid row.

Printed From: Rocket Software
Category: AccuTerm Knowledge Base (read only)
Forum Name: GUI Development
Forum Description: Help for developers creating GUI applications with AccuTerm
URL: https://forum.asent.com/forum_posts.asp?TID=2712
Printed Date: March 26 2026 at 5:25pm
Software Version: Web Wiz Forums 12.03 - http://www.webwizforums.com


Topic: What's the best way to delete a grid row.
Posted By: jgold
Subject: What's the best way to delete a grid row.
Date Posted: March 06 2019 at 3:28pm
I actually have two questions. The first is the interface. Is there a standard way to give the users the ability to delete a grid row? There are a few options;

1. Add a button to each row of the grid to delete that row.
2. Add a button above or below the grid to delete the current row.
3. Add a context button to give the option to delete a row when you right click on it.


The one I thought I would go with is the context button but I couldn't find any examples on how to do the pop up context menu. That's my second question. Does anyone have an example of a pop-up context menu?



Replies:
Posted By: Shrek59
Date Posted: March 06 2019 at 5:18pm
Typically, I create 'Delete row' actions in a standard menu, as a toolbar button, and in a context menu. All of these actions get given the same identifier so I can then redirect the event handlers for the toolbar and the context menu to the main menu event handler.

Using a context menu: First of all, create the popup menu. This is just another control on the form - but it isn't visible. You will see it in the list of controls in the tree. It is defined just like an ordinary menu.

On the grid, activate the GECONTEXT event, and update the program so that the event handler is created. In the event handler, get the row number where the click occurred (guiargs<1, 2>). Watch out for values of -1 which means the user has clicked somewhere where there is no row! If you have a selected row highlighted (like I do), then you should move that highlight now. Next, run the ATGUISHOW subroutine to display the context menu.

Now you need to respond to any events that occur when the user clicks one of the options within the popup menu. There should be another event handler in your program to handle that.

I hope all that makes sense to you.

Using context menus isn't totally intuitive, but it is quite logical when you think about it. i.e. you respond to the right-click by SHOWing the menu; then you respond to the user selection on the context menu.

Cheers,

Brian



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 - http://www.webwizforums.com
Copyright ©2001-2019 Web Wiz Ltd. - https://www.webwiz.net