Results 1 to 40 of 40

Thread: S Grid Help

  1. #1

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    S Grid Help

    Hey everyone, I got a pretty simple question, but I know that there is probably very few here that has ever used S Grid. For anyone that doesnt know or has never used S Grid, you can download and read about it, at the authors website http://www.vbaccelerator.com/home/VB...id_2/index.asp.

    So anyways, here is the question. What is the alternative for the MSFlexGrid's .col & .row for the S Grid? For some reason I cant figure it out and in all the examples in using S Grid that I have seen, they use CellText(row,col) and not using an array of columns and rows the way that I am use to for displaying text.

    So, if anyone could answer my question, or has any suggestions, that would be great. Thank You!

  2. #2

  3. #3
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    Hi,

    Wokawidget probably has answered your question.

    Here is some additional code -

    Dim lRow As Long
    Dim lCol As Long

    With SGrid 'Actually is SGrid-2, but I call it Sgrid
    .Redraw = False
    .Clear
    lRow = 3
    lCol = 5
    .CellTextAlign(lRow, lCol) = DT_CENTER
    .CellText(lRow, lCol) = pubRs!SalesPerson 'Place data into visible cell text
    .CellItemData(lRow, lCol) = pubRs!SalesPersonID 'Place data into Cell's ItemData
    .Redraw = True
    End With

    Feel free to ask further
    Rob C

  4. #4

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    Ok, thanx for the replys! After changing my code around for the use of SGrid, the form seems to load up ALOT faster =). I have one more question though, I was merging the columns using flexgrid, (well, kinda, I never figured out why it sometimes wasnt merging), but I heard that S Grid doesnt do that! Does anyone know away around this of makeing two cells share the same border??

    Btw, what is the difference between S Grid and S Grid 2?

  5. #5

  6. #6

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    Would anyone be able to guide me through the sort procedure?? It seems a lot more complacated then the flexgrid. You have to use the SortObject and it I would appriciate it if someone could help me out. Thanx.

  7. #7
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    Hi,
    Will respond soon tn your questions.

    In the mean time, I am attaching the Help file.
    It is a web page from their site, but I have tweaked it slightly, and it is in a format that allows you to view it off-line.

    Rob
    Attached Files Attached Files
    Rob C

  8. #8
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    The Sort Object is told about which cols to sort eg 3 then 5 then 1
    And whether they are Ascending or Descending.
    And what type of sort to use (Numeric, String, etc)
    You add each col to the sort object, and set those properties

    This is an example -

    'Example for VBForums question
    Private Sub ConfigureGridSorting()
    With SGrid.SortObject
    .Clear
    'I use an array to keep track of the Col numbers (Longs).
    'EG the array may contain 3 5 1
    ' Meaning sort col 3 first, then 5, etc
    ' some where else, you should store whether the sort is Asceneding or Descending.
    'The author's examples use some ColumnSort.... fields
    ' Those are only used for the pgm to store data.
    ' I chose to store that data in arrays, instead.
    'I am not saying my approach is better.
    For i = 1 To myUB
    'We have to add to the collection
    NewSortCol = .Count + 1 '<= NewSortCol this refers to index in the SortObject
    'The first created above, will be 1. Then 2 if you have two sort columns.
    WhichColtoSort = aSortCols(i) '<== This is telling it to point to say Col 3
    ' Next time through the loop, the above will tell it 5
    .SortColumn(NewSortCol) = WhichColtoSort
    If SomePlaceWhereYouStoreAscDesc = 1 Then
    .SortOrder(NewSortCol) = 1 'Ascending
    Else
    .SortOrder(NewSortCol) = 2 'Descending
    End If
    'When I configure the Grid (create it via code)
    ' As I add the Columns, I also store the sort type.
    ' EG Sort as Numeric, or as String etc
    'I store that in SGrid.ColumnSortType (it is only storage)
    'The next line is reading that, and telling the Sort Object about it.
    .SortType(NewSortCol) = SGrid.ColumnSortType(WhichColtoSort)
    Next i
    End With
    Call SortTheGrid
    End Sub

    'ROB has made this a Sub, so that other actions can be taken as well.
    Private Sub SortTheGrid()
    'Exit Sub, if no Rows.
    If SGrid.Rows <= 0 Then
    Exit Sub '<== Exit
    End If
    'If Total line is showing, then remove it
    With SGrid
    If .RowItemData(.Rows) = -999999999 Then
    .RemoveRow SGrid.Rows
    End If
    .Sort
    End With
    End Sub


    Rob
    Rob C

  9. #9
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    There are only two areas in SGrid2 that I have not explored =
    Grouping
    Row-Text Column
    I don't know if they can help your need.

    'Wild other suggestions'
    Switch off grid lines, or
    Choose a color for grid lines, and make the backcolor of adjoining cells the same, so they appear to be one cell

    Rob,

    PS My previous post will be more legible if you copy into an editor, and restore the tabbing.


    Quote Originally Posted by epod69
    I was merging the columns using flexgrid, (well, kinda, I never figured out why it sometimes wasnt merging), but I heard that S Grid doesnt do that! Does anyone know away around this of makeing two cells share the same border??
    Rob C

  10. #10

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    Ok, sorry for that late reply, I got the columns to sort!! I cant be too excited though because for some reason its not sorting how its suppose to..

    Here is my code:

    VB Code:
    1. '##############################################
    2.     '############## ACTIVATE ######################
    3.     '##############################################
    4.    
    5.     ' align morning grid
    6.  
    7.     With MorningGrid
    8.    
    9.         If .Rows > 0 Then
    10.                
    11.             With MorningGrid.SortObject
    12.            
    13.                 .Clear
    14.                 .SortColumn(1) = 2
    15.                 .SortColumn(2) = 3
    16.                 .SortColumn(3) = 1
    17.                 .SortOrder(1) = CCLOrderAscending
    18.                 .SortOrder(2) = CCLOrderAscending
    19.                 .SortOrder(3) = CCLOrderAscending
    20.                 .SortType(1) = CCLSortNumeric
    21.                 .SortType(2) = CCLSortString
    22.                 .SortType(3) = CCLSortDateMinuteAccuracy
    23.            
    24.             End With
    25.            
    26.             .Sort
    27.            
    28.             '// Debugging Purposes //
    29.            
    30.             For i = 1 To .Rows
    31.            
    32.                 For ii = 1 To 3
    33.                
    34.                     .SelectedRow = i
    35.                     .SelectedCol = ii
    36.                    
    37.                     Debug.Print .CellText(i, ii)
    38.                    
    39.                 Next ii
    40.            
    41.             Next i
    42.            
    43.             '// End of Debugging //
    44.            
    45.         End If
    46.        
    47.     End With
    48.  
    49.     ' align afternoon grid
    50.    
    51.     With AfternoonGrid
    52.    
    53.         If .Rows > 0 Then
    54.            
    55.             With MorningGrid.SortObject
    56.                
    57.                 .Clear
    58.                 .SortColumn(1) = 2
    59.                 .SortColumn(2) = 3
    60.                 .SortColumn(3) = 1
    61.                 .SortOrder(1) = CCLOrderAscending
    62.                 .SortOrder(2) = CCLOrderAscending
    63.                 .SortOrder(3) = CCLOrderAscending
    64.                 .SortType(1) = CCLSortNumeric
    65.                 .SortType(2) = CCLSortString
    66.                 .SortType(3) = CCLSortDateMinuteAccuracy
    67.            
    68.             End With
    69.            
    70.             .Sort
    71.            
    72.             '// Debugging Purposes //
    73.            
    74.             For i = 1 To .Rows
    75.            
    76.                 For ii = 1 To 3
    77.                
    78.                     .SelectedRow = i
    79.                     .SelectedCol = ii
    80.                    
    81.                     Debug.Print .CellText(i, ii)
    82.                    
    83.                 Next ii
    84.            
    85.             Next i
    86.            
    87.             '// End of Debugging //
    88.            
    89.         End If
    90.        
    91.     End With

    Here is my what comes up on the debug:

    This is for the Morning Grid
    09:00 AM Showing / 09.00 / Showing
    09:15 AM Appointment / 09.15 / Appointment
    10:50 AM Appointment / 10.50 / Appointment

    This is for the Afternoon Grid
    12:00 PM Appointment / 12.00 / Appointment
    04:00 PM Showing / 16.00 / Showing
    06:00 PM Open House / 18.00 / OpenHouse
    01:30 PM Appointment / 13.30?? / Appointment
    06:20 PM To-Do / 18.20 / ToDo

    So as you can see, something isnt right when sorting the afternoon grid. I am using the same code for the other grid and the other one works just fine. So I am stuck AGain!!
    Any Suggestions??

    Btw, thanx for helping me out so far!

  11. #11
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    Hi,

    Are you using
    With MorningGrid.SortObject
    with the Afternoon grid, instead of
    With AfternoonGrid.SortObject

    I cannot tell which data is in which columns from the example data you are showing.

    If the above does not fix your problem, you can prepare a subset of your pgm, and send it to me (and illustrate what you expect the data to look like after sorting)

    Rob
    Rob C

  12. #12

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    Quote Originally Posted by RobCrombie
    Hi,

    Are you using
    With MorningGrid.SortObject
    with the Afternoon grid, instead of
    With AfternoonGrid.SortObject

    I cannot tell which data is in which columns from the example data you are showing.

    If the above does not fix your problem, you can prepare a subset of your pgm, and send it to me (and illustrate what you expect the data to look like after sorting)

    Rob
    Umm...lol, im an idiot ^-^!! Thanx soo much for noticeing.
    Now the only other thing I have to work on is getting two cells to merge, or make it seem as they are merged. I think I am going to have to use the group method... so if you have any other suggestions, that would be great!! Thanx!

  13. #13
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    Hi,
    Regarding Merging Cells

    You could switch off the vertical grid lines, and align text in two adjoing cells as Right and Left.
    However I raise the question 'is it a clean solution' to be merging columns ?
    The SGrid can be used for a variety of needs, and no doubt some of them may find merging useful.
    But with structured data, surely not ?
    If you are displaying data that is like a visible multi-dimensional array
    (typical use of a grid with columns and Rows), why would you want to merge some of that ?

    Rob
    Rob C

  14. #14
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    PS,

    If it is a desire to show more data than is visible in the cell, you can solve that by having a ToolTip for each cell.
    I have ToolTips om many of my cells, and in one particular column, all the cells have a multi-line ToolTip, that shows 4 dates connected with the Job
    (Creation Date, Date it became a Firm Job. Date it was completed, optional Date it was cancelled, etc)


    Rob
    Rob C

  15. #15
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: S Grid Help

    Hmmmm. I was actually going to post that, but wasn't sure about your methods.
    When you merge cells in a flexgrid, it just prevents the replication of adjacent cells that have duplicate information. They are grouped, and the first cell print whille the cellls below or to the right are blank. Not sure if that is what you wanted or not.

  16. #16
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    Thanks for that.
    Reading your post reminds me of what I studied, long ago, and never used.
    So instead my mind invented it's own definition of merging.

    Before i prattle on further, perhaps epod69 could clarify what he needs.
    (In his post he says 'well kinda')

    If it is as you describe, then I suppose he could switch off grid lines, and his code could detect when the data in the cell below is the same, and blank the text in that cell. It could be done, but I wouldn't recommend adding complexity for cosmetic reasons.

    Rob
    Rob C

  17. #17

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    Hi, and sorry for the late reply. I couldnt for the life of me get my project loaded on my home computer, it kept getting me a run-time error 0. =( Its a royal pain at least for me trying to register the s grid and getting it working properatly because the author doesnt have vb6!! Well anyways, im back at my work computer and I decided it would be best to put part of my project up that I am working on so you can help me out at best.

    When you run the project, a calandar loads up. Most of the events should be in the month February so select the month box and select February. Then double click on a bolded date and the events for that day will load up in a new form. For right now, all i did is highlight the adjacent cell when ever you click on a cell to make it seem as they are both the same cell...its probably not the best way of going around it, the way I am doing it, I dont see how it could work with the grid lines turned on. (There is one wierd little bug right now as well that when you are in the second form, and you click back and forth quickly between the two s-grids, then it will not highlight the adjacent cell..! )

    So anyways, it would be soo great if anyone could go through the attached project and help me out. My main concern is to get a better way of merging the cells and then hopefully fix the main bug. If anyone even has a better way/suggestion for making it a better appearance, that would be great as well.

    Thank you RobCrombie, Wokawidget, and dglienna for posting and helping me out so far!

    dglienna: When you merge cells in a flexgrid, it just prevents the replication of adjacent cells that have duplicate information.
    When you merge cells in flexgrid, you can then make the cells have multilines which is what I am trying to do with S Grid.
    Last edited by epod69; Mar 9th, 2005 at 02:25 PM.

  18. #18

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    Hi all, I got an email stating the following:

    Had a quick look, but it was going to take me too long to try to work out what
    the pgm was doing, and what you specifically needed.
    You coudl -
    - try adding comments to your code
    - get rid of code excess white space and tabbing(too wide)
    - Add little 'Tip' labels to your Forms, so that user (and I) can work out what
    to do.
    The 'Tip' Labels mouseMove event can show a multiline Label giving something
    like context help.
    The Form's Mousemove, can then hide the multiline Help.

    If you do something along the lines of the above, and clarify your problem a bit
    more, I will have another look.
    I guess I should of added comments before I uploaded the project..I have some of my own personal comments but I guess that only helps me out. As for the excessive white spaces and tabbing, that is just my taste in how I like to program, it seems less cluttered to me...but I havent attended any schooling either so I wouldnt really no what the "right" way in programming code would be.

    What is retarded if I think about it, I am going through all this trouble for "cosmetic reasons"..

    And I dont know what I am doing wrong, but I cant get the S Grid 2 to work on my home computer. I am using the same vb6 EE and I have registered it and installed the vb5 run-times and all the steps that were on the site but I cant get it to work =(. So if anyone would like to help me out on that, I will upload the project again with more comments and "tips".
    Thank you all for helping!!

  19. #19
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    Why the VB5 runtime ?
    You should be careful to get the VB6 and other stuff related to SGrid-2, avoiding any of the SGrid (first version) stuff.

    I am trying to get people to use the SGrid-2, and you will be frightening them away.

    I don't usually use controls (though I use user controls ctl), and I just give my user an exe to run (practically every Windows computer, these days, has the VB6 runtime installed already).

    When I decided to go with the SGrid-2, it would have been necessary for me to provide them with install versions of my pgm, which I don't like.
    Instead I created a once only installer for them that places the SGrid-2 and the related SSubTmr6.dll onto their computer. And I still just give them my EXEs like I used to.

    The attached contains only those controls, and makes no other changes to your system. I believe all you have to do is install the attached, and all of your install problems will be over.

    IF i'M CORRECT, AND IT IS THAT SIMPLE, PLEASE POST BACK HERE AND ADVISE ALL THOSE THAT YOU FRIGHTENED OFF, THAT IT IS NOW A PIECE OF CAKE TO USE THE SGRID-2

    Rob
    Attached Files Attached Files
    Rob C

  20. #20

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    Hey again, following up on my previous post, I am putting up my project again, this time, I put step by step comments explaining the best I can on what is going on through the code. I did the comments on the second form only because I dont need any help on the first form at all.. I also put a label on the bottom of the form explaining on what I want to do/need help on.

    So, if anyone would be able to help me out, that would be awsome. If nobody has S-Grid 2, then download RobCrombie's attachment in the above post. As soon as I get home, I will download the S-Grid 2 download on my home computer. Im sure it will work just fine. I also think that if you have never used S Grid before and you try it now, you will never go back to MSFlexGrid again!! S Grid is accually very simple, and yet more advanced then FlexGrid.

    So anyways, if you can, please download my attached project and hopefully post any suggestions that you might have about it. And if you dont have S Grid, then you will need to download the above post's attachment.

    Thanx everyone for your time!
    Attached Files Attached Files

  21. #21
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: S Grid Help

    Epod.

    The way I add more data to my cells is to switch off the normal grid and I add exta vertical or horizontal columns or rows with a width or height of 1 and a backcolour of vbBlack.

    I keep track of the extra columns and rows by using indexes. You can either use Collections or Dictionaries for these depending on your preference.

    So that I know which data I have in a cell I use the RowItemData and ColItemData properties to hold the REAL row and column array information, just in case any edits I do to the grid have to be backtracked through to my source array.

    I really love this grid. I wish it would load a tad quicker though. 20-30mSec a column is what I find. On a large grid this can be a pain. Apart from that it is just so flexible. I especially like being able to use two icons in each cell. And the sort and grouping is to die
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  22. #22
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    Hi,

    InitFlexGrids is slightly longer than 'War and Peace'
    (I haven't finished reading 'War and Peace' yet)

    What if you set the alignment of the upper cell (Time) to be bottom.
    And possibly set the alignment of the lower cell to top.

    That way they will look related, and visibly separate from other entries.
    Rob C

  23. #23
    New Member
    Join Date
    Mar 2005
    Posts
    4

    S2 Grid Help Column Grouping Help Required

    Dear all,
    In S-Grid 2 whenever the user starts grouping on a column, I want to total on a selected column and put it on the grouped row
    e.g. In outloook, if you are grouping on the From address, it has total on the number of mails or total size of the mails from the grouped from address
    I tried to do it in mousedown event, problem if you do grouping on column it is not firing any event.
    Thanks & regards
    Karthikeyan R

  24. #24
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    I try to keep things simple (so I can understand them), so I have not tried Grouping.

    I use mousemove to provide ToolTips. Thus for any cell, I can display whatever.
    Perhaps you could use this code, or tweak it ?
    http://www.vbaccelerator.com/home/VB...gTrak11-12.asp
    Rob C

  25. #25

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Cool Re: S Grid Help

    Hey, and thanx everyone for the replies! I installed the setup for the S Grid controls on my home computer which was posted by Rob, and it ran smooth and effortless and works perfect! Thanx Rob for that.

    Posted by David.Poundall
    Epod.

    The way I add more data to my cells is to switch off the normal grid and I add exta vertical or horizontal columns or rows with a width or height of 1 and a backcolour of vbBlack.
    If I understand you correct David, surrounding the two cells with a lair of columns and rows would make a border appearance arround the two cells giving them an appearance as if they were one cell. If so, that sounds like an excellent idea! In fact, thats pretty much all I am looking for appearance wise. You have also stated that you wish the grids would run a tad quicker. This project that I am working on is a Real Estate program, and the part of the project that I have loaded up is a schedule, and a person can only have so many events (appointments) in a day. So I think in my particular situation, I dont really have to worry about the grids performence.

    Posted by RobCrombie

    Hi,

    InitFlexGrids is slightly longer than 'War and Peace'
    (I haven't finished reading 'War and Peace' yet)

    What if you set the alignment of the upper cell (Time) to be bottom.
    And possibly set the alignment of the lower cell to top.

    That way they will look related, and visibly separate from other entries.
    LOL, I havent read 'War and Peace' either, but I doubt the code is longer then the book. InitFlexGrids will be three times larger once I add all the links from the first form to it, I hope it doesnt effect the purformance..
    I havent thought of setting the upper or lower alignment of the cells either, that also sounds like a great idea!

    r_karthy, I havent tried the S Grids Grouping feature either...sorry

    Anyways, when I work on my project again, I will put in to it all the suggestions and I am sure everything will work out great! I will keep this thread informed on the status of the project, I am sure it wont take long to finish it now, and if requested, I will attach the finished project.

    Thanx everyone for their help and support!!!!
    Last edited by epod69; Mar 10th, 2005 at 02:49 AM.

  26. #26
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    I'm bringing this to top to see if it helps the adjoing post 'SGrid Deployment'
    Rob C

  27. #27

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    Ok, im back at work, and I got a nice black border around every two cells just like I wanted!
    I have run into some more trouble though. =( When the user selects the border, it highlights it just like any other cell, which of course I dont want to happen, so what I did was when the user selects the "border" I have it select the previous cells that were selected before that. This part works fine, so when the user does select the border, it doesnt show any change and the the previous selected cell stays selected. Now, the problem is if you click on the border in the other grid before any other cells, then there is a problem because there was no last selected cell for that grid so the variable lsr (last selected row) becomes 0 and causes an error..

    Here is my code:

    VB Code:
    1. ' If the selected cell is a border (has a black background)...
    2.         If .CellBackColor(lRow, lCol) = vbBlack Then
    3.  
    4.             ' lsr means Last Selected Row and will return 0 if a grid loses
    5.             ' focus and lsr is changed if any cell is clicked on besides the
    6.             ' border, so, lsr = 0 when the first cell of a grid clicked is a
    7.             ' border
    8.             If Not lsr = 0 Then
    9.                
    10.                 ' all this basically does is select the previous cell that was
    11.                 ' selected
    12.                 .SelectedCol = 2
    13.                 .SelectedRow = lsr
    14.                 Call MergeRows(MorningGrid, lsr)
    15.                
    16.             Else
    17.            
    18.                 ' tried to see if setting focus back to the other grid would
    19.                 ' stop the problem but what happens is either the cell stays
    20.                 ' highlighted, or the entire row is cleared (turns white)
    21.                 ' which is really wierd
    22.                 AfternoonGrid.SetFocus
    23.                
    24.             End If
    25.            
    26.             Exit Sub
    27.            
    28.         End If

    So if anyone knows of a better solution about this, that would be great! Thanx everyone!!

  28. #28
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: S Grid Help

    I tend to place my True Row count - by that I mean the row of the array that I am representing in the grid - in the .RowItemData property (it takes longs). The rows that you are using as your grid border also have this property so I will typically place the row true row count of the previous cell in the .RowItemData property of the border row.

    Then if someone clicks on any Row (border or otherwise) I get to my array data using

    MyData=MyArray(.RowItemData(LRow),LCol)

    Every one a winner

    HTH
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  29. #29
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    Hi,
    For anyone wishing to install the ImageList control, as well, I am attaching a better installer, that includes -
    SGrid-2
    the DLL (Subclassing and Timer assistant)
    ImageList Control
    Rob C

  30. #30

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    Hey guys, sorry for the late reply but I have been in the hospital for a while because of ulsers....goes to show you how much stress programming can be sometime =( LOL. But anyways, the good news is I did get the s grids working good and I think I wont need anymore help with them! =) I did use the .RowItemData property, and it acually became very useful, thanx for that suggestion David.Poundall.

    There is one strange thing that I am wondering about.. When I run the project on my home computer, the columns are spaced (width) just how I want them. When I run the project on the work computer, the columns' width's are shorter, which doesnt make any sense, I am running the same code on both computers.

    What would greatly bother me is if I made an executible of the project, that the grids would size differently on some computers...

    Well if anyone knows of what could be causing the column width problems, please reply back. Thank you everyone for helping me out! vbforums Rocks!!!

  31. #31
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: S Grid Help

    My first guess would be a difference in screen resolution.

    What is the difference between your home PC and your work PC?

  32. #32

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    The screen resolution on my home computer is 1028 x 768 and is at 32 bit. The resolution on my work computer is 1280 x 1024 and is at 16 bit. So they are at different resolutions...

  33. #33
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    Your pgm should be able to run on higher resolutions.
    What should happen is the whole Form's image should be smaller.
    Thus smaller column width, and smaller text.
    That shouldn't be a problem as all other pgms would be treated similarly.

    If you are getting smaller columns, AND larger text (text no longer fits the same), that means someone has found the high resolution hard to read and has gone into the advanced button (on the dialog where you change resolution), and changed the DPI setting.
    If that is the case, then change the DPI back to Normal, and stand in the corner for two hours.
    Rob C

  34. #34

    Thread Starter
    Addicted Member epod69's Avatar
    Join Date
    Feb 2005
    Location
    Cambridge, WI - USA
    Posts
    239

    Re: S Grid Help

    Hey, would of never thought of it, but the work computer's DPI was accually set to large font so when I changed it back to normal, the columns got big again, so now it should be the same with my home computer. Thanx for the help RobCrombie!! It took a while to get use to the computer....but I didnt have to stand in the corner for two hours =).

    I tried taking your suggestion you made earlier about have the cell text aligned, the top being aligned to the botttom and the bottom being aligned to the top to make it look more merged.

    I tried doing this..:
    Code:
    MorningGrid.CellTextAlign(Mr, Mc) = DT_CENTER And DT_BOTTOM
    MorningGrid.CellTextAlign(Mr, Mc) = DT_CENTER And DT_TOP
    I cant get it to work at all, is there something I am doing wrong?

    Btw, Mr and Mc are in an array and this is pretty much what it is in my code..:

    For i = 1 to 2

    Mr = i
    Mc = 2

    Next i
    Last edited by epod69; Mar 23rd, 2005 at 01:20 PM.

  35. #35
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    DT_BOTTOM
    didn't work.

    DT_BOTTOM Or DT_SINGLELINE Or DT_END_ELLIPSIS
    worked.

    Let me know how that goes for you.
    Rob C

  36. #36
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: S Grid Help

    PS
    Whilst searchiing for why that was necessary, I came across this
    (Which might mean something to people that have used this API call) -

    # CellTextAlign - Gets/sets the alignment and formatting properties used to draw cell text. The format used is the same as that used by the GDI API call DrawText and hence allows you to specify horizontal and vertical alignment as well as whether the text is single line or wrapped and/or whether the text is truncated.

    And also noticed these, which may come in handy, one day -

    # EvaluateTextHeight - Determines the ideal height required to display all the cell's text in a cell. This property is only of any use if the Cell's CellTextAlign property allows multiple lines.
    # EvaluateTextWidth Determines the ideal width required to fully display text in a cell.
    Rob C

  37. #37
    Member
    Join Date
    Nov 2005
    Location
    Phoenix, Arizona
    Posts
    34

    Re: S Grid Help

    This looks like interesting thread.
    I have a problem with editing data in SGrid 2. I'm connecting to SQL Server 2000. When user clicks on a row in SGrid 2, set of controls(datepickers, text and comboboxes) is filled with data from that row.
    Data is edited in those controls and everything works fine if I dont drag column for grouping. If data is grouped by any column, record is edited and saved into database correctly, but it is not displayed in the grid until I restart whole program.
    I also noticed that clicking on row group header displays "missing" record in controls. When I return to grid view without grouping, "missing" record is still missing, whole bunch of blank rows is added to the top of the grid and last record is duplicated at the bottom.
    Does anyone have idea of what I'm doing wrong?
    Here is the procedure that fills SGrid:
    VB Code:
    1. Private Sub addData()
    2.    
    3.     grdThis.ClearSelection
    4.     grdThis.Redraw = False
    5.    
    6.     Dim rsLoadGrid As ADODB.Recordset
    7.     Dim strSql As String
    8.     Dim intCol As Integer
    9.     Dim intRow As Integer
    10.     Dim rsCol As Integer
    11.     Dim rowAlign As Integer
    12.     Dim lCol As Integer
    13.    
    14.     On Error GoTo 0
    15.      
    16.     strSql = "SELECT NameID, Name, Agency, ReportsTo, EmployeeOrTempIDNumber, EmailAddress, ACAPSID, LanID, TeamID, Extension, AUNumber, HireDate, "
    17.     strSql = strSql + " GraduationDate, Expectation, NumberOfFilesAssignedInTransition, NumberOfFilesOutOfTransition, DateDroppedOut, Products, HMDA, APR, CIP, LIA,"
    18.     strSql = strSql + " HINS , FINS, PricingEngine, Valuation, Fee, Title, VOI, Final FROM tblName ORDER BY HireDate, Name"
    19.  
    20.    
    21.     Set rsLoadGrid = New ADODB.Recordset
    22.  
    23.     With rsLoadGrid
    24.         .CursorLocation = adUseClient
    25.         .Open strSql, cn, adOpenDynamic, adLockOptimistic
    26.     End With
    27.  
    28.    
    29.  
    30.     With grdThis
    31.         intRow = 1
    32.         rsLoadGrid.MoveFirst
    33.         Do While Not rsLoadGrid.EOF
    34.             'Add the row (empty)
    35.             .AddRow
    36.             '.AddRow "" works for FlexGrid
    37.             'Set the values one cell at a time
    38.         For intCol = 1 To rsLoadGrid.Fields.Count
    39.  
    40.             'recordset counter has to start from 0
    41.             rsCol = intCol - 1
    42.             'if you want to format the text for some columns differenly, use If/Else or Select Case here
    43.             'TextMatrix works for FlexGrid, need to use .CellText for SGrid2
    44.             .CellText(intRow, intCol) = (rsLoadGrid.Fields(rsCol).Value)
    45.             If IsNull(rsLoadGrid.Fields(rsCol).Value) Then
    46.                 .CellText(intRow, intCol) = Empty
    47.             End If
    48.             '.TextMatrix(lngRow, lngCol) = p_objRecordset.Fields(lngCol).Value & ""
    49.         Next intCol
    50.             'Align date columns
    51.             rowAlign = intRow
    52.             .CellTextAlign(rowAlign, 12) = DT_RIGHT
    53.             .CellTextAlign(rowAlign, 13) = DT_RIGHT
    54.             .CellTextAlign(rowAlign, 17) = DT_RIGHT
    55.             'Increment our row counter
    56.           intRow = intRow + 1
    57.             'Move to the next row of data
    58.           rsLoadGrid.MoveNext
    59.         Loop
    60.     End With
    61.    
    62.     'Autosize columns
    63.     Screen.MousePointer = vbHourglass
    64.     With grdThis
    65.  
    66.        For lCol = 1 To .Columns
    67.           .AutoWidthColumn lCol
    68.        Next lCol
    69.  
    70.     End With
    71.    
    72.     Screen.MousePointer = vbDefault
    73.  
    74.     grdThis.Redraw = True
    75.        
    76.     rsLoadGrid.Close
    77.     Set rsLoadGrid = Nothing
    78.  
    79. End Sub

  38. #38
    New Member
    Join Date
    Dec 2021
    Posts
    2

    Re: S Grid Help

    Quote Originally Posted by RobCrombie View Post
    Why the VB5 runtime ?
    You should be careful to get the VB6 and other stuff related to SGrid-2, avoiding any of the SGrid (first version) stuff.

    I am trying to get people to use the SGrid-2, and you will be frightening them away.

    I don't usually use controls (though I use user controls ctl), and I just give my user an exe to run (practically every Windows computer, these days, has the VB6 runtime installed already).

    When I decided to go with the SGrid-2, it would have been necessary for me to provide them with install versions of my pgm, which I don't like.
    Instead I created a once only installer for them that places the SGrid-2 and the related SSubTmr6.dll onto their computer. And I still just give them my EXEs like I used to.

    The attached contains only those controls, and makes no other changes to your system. I believe all you have to do is install the attached, and all of your install problems will be over.

    IF i'M CORRECT, AND IT IS THAT SIMPLE, PLEASE POST BACK HERE AND ADVISE ALL THOSE THAT YOU FRIGHTENED OFF, THAT IT IS NOW A PIECE OF CAKE TO USE THE SGRID-2

    Rob
    Hi, Why I can't download attached files from this post(#19)? Tanks.
    Last edited by It.Behrooz; Dec 29th, 2021 at 07:14 AM.

  39. #39
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,914

    Re: S Grid Help

    If you're talking about the attachments to post #19 or #29, by the names of the attachments, they almost certainly had executable code in them, and that's not allowed on these forums. It's a terribly old thread, but you might try PMing the posters and see if they'll re-post with only the source code.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  40. #40
    New Member
    Join Date
    Dec 2021
    Posts
    2

    Re: S Grid Help

    Quote Originally Posted by Elroy View Post
    If you're talking about the attachments to post #19 or #29, by the names of the attachments, they almost certainly had executable code in them, and that's not allowed on these forums. It's a terribly old thread, but you might try PMing the posters and see if they'll re-post with only the source code.
    Thank you for your prompt reply. It's my first post in this forum. Yes , i mean post #19 or #29 and correct my post. Thank a again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width