Link to home
Start Free TrialLog in
Avatar of gem56
gem56

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Dana Seaman
Dana Seaman
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gem56
gem56

ASKER

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
Avatar of gem56

ASKER

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.
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?

Avatar of gem56

ASKER

Thanks a lot for that, I really appreciate it.
/Michael
Avatar of gem56

ASKER

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