How do I populate a StringGrid using a reference to row & column?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
bossydog9
Junior Coder
Posts: 29
Joined: Wed Jan 08, 2020 12:46 pm

How do I populate a StringGrid using a reference to row & column?

Post by bossydog9 » Wed Feb 19, 2020 6:04 pm

I've done a search but can't find an example showing how to populate a StringGrid object by using a cell reference. However, I did find this post, viewtopic.php?t=8635, detailing how to do what I want, but this is a workaround and over 4 years old. Marcus mentioned that the functionality to read and write directly from/to a StringGrid cell was on the list to do. Is this functionality now available?

Also, in the help topic showing the StringGrid object properties, there is the Options property that has 18 options that specify various display and behavioural properties of the grid, but these options are not described. I found descriptions for them in an uploaded script by JRL in this post, viewtopic.php?f=1&t=10451:

Code: Select all

/*
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goRowSizing, goColSizing, goRowMoving, goColMoving, goEditing, goTabs, goRowSelect, goAlwaysShowEditor, goThumbTracking, goFixedColClick, goFixedRowClick, goFixedHotTrack]

goFixedVertLine     Vertical lines are drawn to separate the fixed (nonscrolling) columns in the grid.
goFixedHorzLine     Horizontal lines are drawn to separate the fixed (nonscrolling) rows in the grid.
goVertLine          Vertical lines are drawn to separate the scrollable columns in the grid.
goHorzLine          Horizontal lines are drawn to separate the scrollable rows in the grid.
goRangeSelect       Users can select ranges of cells at one time. goRangeSelect is ignored if Options includes goEditing.
goDrawFocusSelected Cells with input focus are drawn with a special highlight color, just like selected cells without input focus. If goDrawFocusSelected is not included, the cell with input focus is distinguished by a focus rectangle, not by a special background color.
goRowSizing         Scrollable rows can be individually resized.
goColSizing         Scrollable columns can be individually resized.
goRowMoving         Scrollable rows can be moved using the mouse.
goColMoving         Scrollable columns can be moved using the mouse.
goEditing           Users can edit the contents of cells. When goEditing is included in Options, goRangeSelect has no effect.
goTabs              Users can navigate through the cells in the grid using TAB and SHIFT+TAB.
goRowSelect         Entire rows are selected rather than individual cells. If goRowSelect is included in Options, goAlwaysShowEditor has no effect.
goAlwaysShowEditor  The grid is locked into edit mode. The user does not need to press ENTER or F2 to turn on EditorMode. If Options does not include goEditing, goAlwaysShowEditor has no effect. If Options includes goRowSelect, goAlwaysShowEditor has no effect.
goThumbTracking     The grid image updates while the user is dragging the thumb of the scroll bar. If goThumbTracking is not included, the image does not update until the user releases the thumb in a new position.
goFixedColClick     The grid supports clicking fixed columns. goFixedColClick is useful when you have fixed columns in the grid control.
goFixedRowClick     The grid supports clicking fixed rows. goFixedRowClick is useful when you have fixed rows in the grid control.
goFixedHotTrack     The grid supports hot-tracking of fixed columns or rows. goFixedHotTrack instructs the grid to highlight the fixed cells whenever the mouse passes over them. 
/*
Where do these descriptions come from? They're not in the knowledge base or manual...or is this stuff only available to Wizards? :)

User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: How do I populate a StringGrid using a reference to row & column?

Post by PepsiHog » Thu Feb 20, 2020 1:03 am

@bossydog9,
The short of it is, right now, you can't. I feel your pain. I wanted the same thing.

I hope Marcus has a very short To-Do list, because I would REALLY like to have this functionality.

PepsiHog

That post, you refer to, is only a month or so old. And it was mine. Also, JRL is an extremely helpful person. He likely spent his own time writing that up, just to help. Wish we had hundreds of users that were so knowledgeable, and generous.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: How do I populate a StringGrid using a reference to row & column?

Post by PepsiHog » Thu Feb 20, 2020 1:13 am

mmmmm.....wonder if we could clone him......
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: How do I populate a StringGrid using a reference to row & column?

Post by PepsiHog » Thu Feb 20, 2020 1:40 am

Just
Really
Lavish
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts