[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1466
  • Last Modified:

How to edit SGrid2.0 cells

Hi experts,

I am trying to use vbAccelerator SGrid2.0 control (http://www.vbaccelerator.com/home/VB/Code/Controls/S_Grid_2/S_Grid_2/VB6_SGrid_2_Binary.asp) but for some reason I'm just not able to edit the cells. I'm able to create columns and rows but simply can't enter edit mode, even though I set Editable to True, please see my code below.

I double click on a cell to try editing it, which works in the demo program.

When I run the (available) demo program I can edit cells when 'Editable' is set to True. I'm confused, what am I missing here?

Thanks,
     Michael

Private Sub Form_Load()
    With vbalGrid
        .Redraw = False
        .Editable = True
       
        .AddColumn "Col1", "Col1", , , 100
        .AddColumn "Col2", "Col2", , , 100
       
        .CellDetails 1, 1, "--r1c1--"
        .CellDetails 1, 2, "--r1c2--"
       
        .CellDetails 2, 1, "--r2c1--"
        .CellDetails 2, 2, "--r2c2--"
       
        .Redraw = True
    End With
End Sub
0
gem56
Asked:
gem56
  • 4
  • 2
1 Solution
 
danaseamanCommented:
The Edit TextBox is not in the control. You must instantiate one on you client Form and add appropriate code to the following sGrid2 Events:

RequestEdit
PreCancelEdit
CancelEdit

The sample code to do this can be found at this link:
http://vbaccelerator.com/home/VB/Code/Controls/S_Grid_2/Using_Editable_Mode/article.asp

If you need any help with this let me know.
0
 
gem56Author Commented:
That's done it. Thanks a lot.
Actually I did something similar a fair while back so the examples in the link that you provided make sense. It didn't click to me as I was expecting that mechanism to be part of the control.

/Michael
0
 
gem56Author Commented:
Hi danaseaman,
Seeing that you know about this control I was wondering if you could help me with one more thing.

I've made some minor changes to the sample code to accommodate my specific requirement and all works Ok with the exception of one thing.
Pressing Tab (when not in edit mode) moves focus from one cell to another, until the last cell (in a row) is reached. At that point a Beep is given instead of going to the first cell of the next row.

I've tried using available events to detect key press when at last cell so that I could manually select the first cell of the next row no event is given in that particular situation, or at least I'm not able to identify any useful event to help me.

Any ideas?

/Michael

P.S. I have no problems opening another posting but I thought this was the easies way to get your attention.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
danaseamanCommented:
As far as I know sGrid2 does not implement IOLEInPlaceActiveObject so the standard behaviour is for the Tab to cycle through the controls on your Form. To implement IOLEInPlaceActiveObject see this article which BTW is also what one would do if using CreateWindowEx within a UserControl.

http://www.vbaccelerator.com/home/VB/Code/Techniques/Trapping_The_Tab_Key_in_a_UserControl_with_IOLEInPlaceActiveObject/article.asp

Have you implemented IOLEInPlaceActiveObject?

0
 
gem56Author Commented:
Thanks a lot for that, I really appreciate it.
/Michael
0
 
gem56Author Commented:
I was too quick on the trigger, sorry.

No I haven't implemented IOLEInPlaceActiveObject. I was initially looking at using ListView for a small project but needed a bit more functionality and then I came across SGrid. It looked to have sufficient functionality for my requirements but of course I wasn't able to work out how to edit cells until you helped me. (Thanks again).

After resolving that issue by modifying the sample code and working out the flow of user interaction with the new application, I identified this last issue so I haven't done too much development at this stage. It's been mainly to identify the screen layout and user interaction/flow of events.

Having just read the article at the link that you provided, I'll give it some thought as to whether to try resolving this issue or not. I usually try to avoid straying away too much from the standard interfaces, unless I really have no option, as it may lead to compatibility issues.

Once again thanks a lot for your help.

/Michael

0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now