Solved

How to edit SGrid2.0 cells

Posted on 2006-11-29
6
1,397 Views
Last Modified: 2013-12-26
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
Comment
Question by:gem56
  • 4
  • 2
6 Comments
 
LVL 22

Accepted Solution

by:
danaseaman earned 250 total points
ID: 18045653
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
 

Author Comment

by:gem56
ID: 18045974
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
 

Author Comment

by:gem56
ID: 18050343
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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 22

Expert Comment

by:danaseaman
ID: 18052707
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
 

Author Comment

by:gem56
ID: 18053107
Thanks a lot for that, I really appreciate it.
/Michael
0
 

Author Comment

by:gem56
ID: 18053191
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question