SIGrid Question, How To Clear?

Started by Fred Harris, April 24, 2006, 10:35:43 PM

Previous topic - Next topic

Fred Harris

Don't  know how to clear grid.  I can't believe there isn't a clear or cls type routine.  I realize I could run each cell through a double For Loop but can't believe there isn't a simple internal command for this.

The siSetRowData() function looks like a possibility, but the documentation isn't good enough for me to figure out how to use it.  No examples.  I don't
want to sound like a complainer -  I really like this grid.  It is the typical case
of being able to figure out all the hard stuff and then being stumped by something that ought to be trivial.  I'm sure you've all been there.   Would
anyone know the best way to do this?

Fred

Fred Harris



For i=1 To siGetRowCount(hGridWnd)
  For j=1 To siGetColCount(hGridWnd)
     siSetCell(hGridWnd,i,j,"")
  Next j
Next i
Call siRefreshGrid(hGridWnd)



If anyone from SIGrid is listening, this would be nice...

siClearGrid

The siClearGrid function clears the specified grid.

siClearGrid(ByVal hWnd As Long) As Long

Parameters

hWnd - Handle to the grid.
Return Values

If no error occurs the number of rows cleared is returned.
If errors occur the return value is 0.

JR Heathcote

To quote a defrocked president "I feel your pain".

I have resorted to using the same code you do to clear the grid.  This may not work too well for grids containing a large amount of data.  In this case you may want to use the function:


siSetRowCount (ByVal hWnd As Long, RowCount As Long, ByVal Force As Long) As Long


To resize the grid to a smaller size then set it again to a larger size, should clear out the entries quickly.

Your idea for a Clear Grid function is a good one, send it to Chris Bristow.

Fred Harris

Hadn't thought of that JR.  I guess that would work too.  I'm still thinking the siSetRowData() might be quickest, if one could get it to work.  By the way, I'm just new to the SIGrid.  Only bought it the other day.  Had been using Jose Roca's COM code to access MSFlexGrid.ocx.  I used to use that grid big time for years with VB.  However, I was surprised to see how much quicker the SIGrid is compared to the MSFlexGrid, which is kind of a bloated monster weighing in at several hundred K with support modulesand all.

I'll make my request to Chris Bristow.

JR Heathcote

Since you are the one who is doing the grid clearing I will leave it up to you to figure out the "quickest" way.  I would think with using the siSetRowData() function you would still need to loop through the grid rows and clear each one separately.  With resizing the grid you would clear the first line, resize the grid to the first line, then expand it back out to the desired size.  Three lines of code, with no looping involved.  I would think this would be very fast.

I also used the MSFlexGrid control in VB, and you're right, it is a quirky collection of bloat ware.  One of the main reasons I switched to PB, lean and mean.

You also might want to consider purchasing EGRID32.  I think it is about the same price, but has a lot more functionality than SIGRID.  If I need spreadsheet functionality EGRID32 is my obvious choice.

Elias Montoya

Quote from: JR HeathcoteYou also might want to consider purchasing EGRID32.  I think it is about the same price, but has a lot more functionality than SIGRID.  If I need spreadsheet functionality EGRID32 is my obvious choice.

Thanx!! :)

Hey by the way, Egrid32 has detailed information and lots of options to
clear the grid contents:


EG_CLEARGRID Command

%EG_CLEARGRID  Clearing options.  N/A.  Clears Grid's Text and some other areas in several ways.  

Comments:
This command is used to delete Text stored in the grid. It can optionally clear other grid settings if desired. Here is a list of options aviliable for this command:
    * EG_CLEARDESIGNMODE  Clears the text in design mode.  
    * EG_CLEARFULLLINEMODE  Clears the text in Full Line Mode.  
    EG_DONTDELETEOBJECTS If this option is set, a copy of the objects in the grid (such as icons and bitmaps) must be stored externally in order to be able to delete them later manually.  
    EG_DONTRESETCOLSIZES  If this option is set, the command will not reset the Column sizes to their default size. (See EG_SETDEFAULTCOLUMNWIDTH)  
    EG_DONTRESETROWSIZES  If this option is set, the command will not reset the Row sizes to their default size. (See EG_SETDEFAULTROWHEIGHT)  
    EG_CLEARIMAGELISTS At the moment this command does nothing, its added for future implementation.  
    EG_CLEARCOLFUNCTIONS If this option is set, The command will remove the column functions from all the columns and free all used memory.  
    EG_CLEARCOLFONTS  If this command is used, the command will reset all column settings to their default.  
    [/list]
    * This options are required, if none of them are specified, this command will clear the text in the current grid mode. When using virtual mode, no text will be deleted if none of this parameters are used.

    Clearing the grid will not modify its size.

    When clearing Design mode, any cell that has controls in them will be reset. This will trigger the EGN_ABOUTDELETINGCONTROL Notification message.

    Return Values:
    If successful, this command will return True, otherwise a null value will be returned.

    Related Topics:
    Clearing Grid contents EG_SETDEFAULTCOLUMNWIDTH EG_SETDEFAULTROWHEIGHT EGN_ABOUTDELETINGCONTROL

    Fred Harris

    Elias,

        I feel really bad I couldn't see my way clear to buy your grid but let me tell you why I didn't, as I was really close to buying it.  I looked at both yours and the SIGrid pretty close, and I feel I may be somewhat of a 'connoisseur' of grids, having used them since the early days of Visual Basic.  The reason is its size!  I was appalled at the 468K size of the dll.  

        I really wanted a somewhat 'minimalist' grid.  All I really wanted was as follows:

    1) ability to set column widths;
    2) ability to set number of rows;
    3) internal handling of scroll bar messages;
    4) ability to put data in and get it out easily;

        If your grid was double the price and less than the 47K of the SIGrid I
    would have bought yours.  Perhaps you ought to sell two tools, one for people that want spreadsheet functionality and one for people that just want a simple grid.

    TechSupport

    I remember that Elias was thinking about creating a cut down version of EGrid (posts in the PowerBASIC forum). I think a bare bone, read-only grid would be a fantastic idea especially for a lot of applications that merely need to display tabular data. I currently use an ownerdrawn, virtual, ListView for that purpose but it has its limitations and is not overly flexible.

    Fred Harris

    Actually, read only wouldn't help me.  I guess I just assummed
    that in my list above.  So I guess I do need more than a minimalist
    grid huh?

    Elias Montoya

    Quote from: TechSupportI remember that Elias was thinking about creating a cut down version of EGrid (posts in the PowerBASIC forum). I think a bare bone, read-only grid would be a fantastic idea especially for a lot of applications that merely need to display tabular data. I currently use an ownerdrawn, virtual, ListView for that purpose but it has its limitations and is not overly flexible.

    Actually, i have it right here... Somewhere. I never released it because
    my beta testers realized that most of the features in Egrid32 are
    very useful... so the mini grid started to grow and it was becoming
    Egrid32 as it is now. Hehehehe.

    And since Egrid32 can be compressed down to less than 100Kb, we saw not much need to make it a bit smaller. But, Actually, i was thinking about
    that yesterday. I might release the trimmed one in few days.

    Fred Harris

    I started using grids way back in VB3 or 4, just when I was learning
    Windows programming, and having to suffer through writting DOS programs
    that allowed for data entry in a tabular sort of environment I thought
    grids would be the answer to all my data entry coding problems.  Little
    did I realize at first that my problems were only beginning!

        What I was trying to use grids for was ultra high efficiency data
    entry of large volumes of repetitious data.  And I was attempting to
    program them so that the focus would jump to the next cell to the right
    after a predetermined number of keystrokes, so as to avoid having to
    hit the [ENTER] or [TAB] key to move between fields.  This may seem to
    be a small thing (both the need to do this, or the programming to make
    it happen, but it really isn't).  Just last month one of our two data
    entry girls went on permanent disability due to carpel tunnel syndrone
    and related maladies from doing excessive data entry.  Very hard on hands
    and tendons.  I'm a forester and program data entry routines for both
    hand held data collectors and desktops to handle entry of thousands upon
    thousands of trees for timber sales.  So making the data entry flow
    easily when large amounts of data are to be entered is important.

        I've never really solved the problem.  In DOS it wasn't too hard.  
    You would just count keystrokes from the input buffer and jump to the
    next cell/field when necessary.  In Windows with grids it is much
    trickier.  Not only do you have the cursor motion keys to worry about
    but the mouse too.  The only solution I have come up with is to write my
    own custom grids for my apps, which I do - especially data recorder apps.

        I'm just running on here about grids I guess cuz most of my
    difficulties relate to them.  But people like them in apps so I try
    to oblidge.

    Haakon Birkeland

    QuoteI might release the trimmed one in few days.
    You could maybe use a trimmed down, but somewhat useful, freeware version as a "promotional teaser", to let potential users for the full grid become familiar with your product. Once they want/need the "fancy/fun" and advanced stuff, I would assume it then would be easier to go for your grid than any competing product.

    On the other hand, it might bite your behind in some cases as they won't buy the full grid when the freeware version does the job. - Can't win them all.  :?

    Elias Montoya

    Fharris, Egrid32 can do that and much, much more. And can be
    compressed down to less than 100Kb. even more, Egrid32 can also
    be included in your PowerBASIC executable (also with Firefly) as
    embedded code (so your executable doesnt require the dll).

    Egrid32 is a different approach from Sigrid. With sigrid, you can
    fill a type and send the information to set it up, but i think the code
    gets messy and it adds the remaining kilobytes in your code.  :shock:
    Or like in this case, you had to code or look for a way to do something
    that the grid should have!

    Egrid32 does many things internally, instead of having to code things
    externally in your code, this way, your code contains only your code,
    and not the code required to do something with the grid. Of course
    you can do it too if you want, as i have shown many times. Egrid32 is
    very flexible.

    For example, Egrid32 can display a background image that scrolls
    (automatically) with the background, or you can set it as static, or
    tiled, or at static rows... etc... All this is handled internally, and if
    you try to code this externally in sigrid, Good luck. Maybe it can
    be done, but you will see why the size of Egrid32. Besides things like
    this, it has hundreds of other goodies. If you knew all what you can
    do with Egird32, you will wonder how did i put that many goodies in
    around 400Kb, and you will be amazed when you compress it. :)

    Haakon, yeah, that is one of the side effects that i thought, and was
    preventing me from releasing it. :) I think i will release this trimmed
    version to the registered users, wich by now are a pretty good number
    of them. :wink:

    Haakon Birkeland

    QuoteI think i will release this trimmed version to the registered users..
    That's a good thing too. I assume quite a few of them are more than interested in "the size of their equipment".  :D

    Haakon Birkeland

    Hi Elias
    I disagree with you . I was one of the first proponent for a light Egrid. My needs are very simple a quick editable grid.
    I refuse to add things in my program that I will never use.
    I ended up using RvLv from Roberto as an editable grid because it is simple to use and I can incorporate the code right in my program so no DLL.
    I have been using FF more and more because of the fact that unlike EZGUI there is no need of adding a DLL to my programs.
    My wishes for a grid would be something like RvLv that could be added from the tools property and incorporate the code in the program when selected. Then I could see in the designer what the form will look like.
    My feelings on Egrid is that even though it is a Mona Lisa. I see no use to it when all I need is a Etch-A- Sketch tool.

    I would be willing to pay extra to FF if such a simple tool as an editable grid could be purchased as an add on.

    Bert
    Haakon 8o)