Zumasys Homepage
Forum Home Forum Home > AccuTerm > GUI Development
  New Posts New Posts RSS Feed - What's the best way to delete a grid row.
  FAQ FAQ  Forum Search   Register Register  Login Login

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

 Post Reply Post Reply
Author
Message
jgold View Drop Down
Moderator Group
Moderator Group

Moderator

Joined: December 29 2003
Location: United States
Status: Offline
Points: 48
Post Options Post Options   Thanks (0) Thanks(0)   Quote jgold Quote  Post ReplyReply Direct Link To This Post Topic: What's the best way to delete a grid row.
    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?
Back to Top
Shrek59 View Drop Down
Senior Member
Senior Member


Joined: December 04 2006
Location: New Zealand
Status: Offline
Points: 183
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shrek59 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.