Solved

How to edit SGrid2.0 cells

Posted on 2006-11-29
6
1,386 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now