
StringGrid 101
Moderators: JRL, Dorian (MJT support)
StringGrid 101
Hello All,


Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) 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!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) 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!
Re: StringGrid 101
Here's one way. Though I'm cheating on the remove the highlight part. Not sure it can actually be done.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 559
Top = 133
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'StringGrid Play'
ClientHeight = 212
ClientWidth = 476
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object MSStringGrid1: tMSStringGrid
Left = 16
Top = 14
Width = 320
Height = 120
ColCount = 4
FixedCols = 0
RowCount = 1
FixedRows = 0
Options = [goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goDrawFocusSelected, goColMoving, goFixedColClick, goFixedRowClick, goFixedHotTrack]
TabOrder = 0
ColWidths = (
60
60
60
0)
end
object MSButton1: tMSButton
Left = 129
Top = 161
Width = 75
Height = 25
Caption = 'Move in Grid'
TabOrder = 9
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
//if you want to get the data from a file ...
//ReadFile>c:\temp\mcsv.txt,CSVData
//or we could use a label ...
/*
CSVDataLabel:
Shape,Colour,Size
Triangle,Red,Large
Square,Blue,Small
Oval,Yellow,Medium
*/
LabelToVar>CSVDataLabel,CSVData
SetDialogProperty>Dialog1,MSStringGrid1,LoadFromCSV,CSVData
SetDialogProperty>Dialog1,MSStringGrid1,FixedRows,1
AddDialogHandler>Dialog1,msButton1,OnClick,GridMove
Show>Dialog1,dlgResult
SRT>Update
SetDialogProperty>Dialog1,MSStringGrid1,LoadFromCSV,CSVData
SetDialogProperty>Dialog1,MSStringGrid1,FixedRows,1
END>Update
SRT>GridMove
UIFocus>StringGrid Play,MSStringGrid1
Wait>0.5
Press left * 10
Press up * 10
Wait>0.5
Press right
Wait>0.5
Press right
Wait>0.5
Press down
Wait>0.5
Press down
Wait>0.5
Press right
END>GridMove
/*
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.
/*
Re: StringGrid 101
@JRL,
Thanks. Yea, the macro portion I can't really use. I'm writing a 'some kind' of database sort of thing, so having it do a macro is undesirable.
I really looked into it myself before posting. I had hoped it was like ComboBox with an index property.
Giving it a second look, I like how you used uiFocus. It's not like I was thinking, you know, move here, click here, eat at Joe's, that sort of macro.
I do believe I am leaning towards using it. Pretty good solution! I like it.
Have a Pepsi, my treat. Send me the bill.
With your writing ability, maybe you could write an ever changing, learning macro. You know, a few lines, a few loops, no big deal sort-of-thing. First AI with Macro Scheduler. Of course, let's not forget LibFunc. You'll want as many as you can think of.
Cheat on,
PepsiHog
Thanks. Yea, the macro portion I can't really use. I'm writing a 'some kind' of database sort of thing, so having it do a macro is undesirable.
I really looked into it myself before posting. I had hoped it was like ComboBox with an index property.
Giving it a second look, I like how you used uiFocus. It's not like I was thinking, you know, move here, click here, eat at Joe's, that sort of macro.
I do believe I am leaning towards using it. Pretty good solution! I like it.
Have a Pepsi, my treat. Send me the bill.

With your writing ability, maybe you could write an ever changing, learning macro. You know, a few lines, a few loops, no big deal sort-of-thing. First AI with Macro Scheduler. Of course, let's not forget LibFunc. You'll want as many as you can think of.

Cheat on,
PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) 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!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) 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!
Re: StringGrid 101
So...
In your "eat at Joe's" dream/nightmare scenario. Do they serve Pepsi? How about Mt Dew Throwback..? My preference.
The script is just an example but AFAIK you would have to use arrow keys (or mouse click) to programatically move about. I'm not aware of an object property to set a grid cell as active. Have you looked up "StringGrid" on a Delphi site?
What occurs that you want to move between cells? Is it one cell movement perhaps after a data entry?
In your "eat at Joe's" dream/nightmare scenario. Do they serve Pepsi? How about Mt Dew Throwback..? My preference.
The script is just an example but AFAIK you would have to use arrow keys (or mouse click) to programatically move about. I'm not aware of an object property to set a grid cell as active. Have you looked up "StringGrid" on a Delphi site?
What occurs that you want to move between cells? Is it one cell movement perhaps after a data entry?
Re: StringGrid 101
Hi JRL,
Are you kidding? Do you really believe I would own an establishment that didn't have Pepsi and Pepsi products? And there would be a "Happy Hour"! Not that it's needed. I'm happy any time I drink Pepsi. If left to me, it would be a nightmare. Get the blood flowing. Plus, during those life and death moments, can make a person be more creative and inspired. Think of the macros they might share here on the forum.
No. I was unaware that I could look it up on a Delphi site. I've known you for how many years? And you only just now tell me this? What else are you holding out on me? And, what's with the "no link" thing? Have you been drinking products not of the Pepsi family?
It's all about the illusion. I have two panels(black). Each panel has four green panels(pages). Each green panel has a StringGrid. Each black panel is identical. When I click "previous" or "next" the black panel shifts it's left to show the next page. Each black panel has two dummy pages(StringGrids) at the left and right ends of the black panel. They are partially "off-screen" on the black panel. But they display a portion of the next/previous page. One black panel is always not visible. When you click towards the dummy page, the black panel you don't see, shifts to an offset to cover the dummy with a real page. It's loaded with the four appropriate pages. When I click towards a dummy page, the not visible appears and the black panel scrolls to display the next or previous page. Since the black panels are identical and the page info is the same, you can't perceive the appearance of the alternate black panel. The illusion is complete. It gives the illusion the pages are in this large circle of continuous pages. When the pages scroll and the same cell is highlighted on another, it kinda gives away the illusion. So I want the highlight to move to the first cell once that page is off-screen. So it appears as though all pages are set to the first cell by default.
You have only yourself to blame. You asked. Happy Thanksgiving!
PepsiHog
edit - And yes, I AM cdo.(That's ocd in the correct order.)
Are you kidding? Do you really believe I would own an establishment that didn't have Pepsi and Pepsi products? And there would be a "Happy Hour"! Not that it's needed. I'm happy any time I drink Pepsi. If left to me, it would be a nightmare. Get the blood flowing. Plus, during those life and death moments, can make a person be more creative and inspired. Think of the macros they might share here on the forum.
No. I was unaware that I could look it up on a Delphi site. I've known you for how many years? And you only just now tell me this? What else are you holding out on me? And, what's with the "no link" thing? Have you been drinking products not of the Pepsi family?
It's all about the illusion. I have two panels(black). Each panel has four green panels(pages). Each green panel has a StringGrid. Each black panel is identical. When I click "previous" or "next" the black panel shifts it's left to show the next page. Each black panel has two dummy pages(StringGrids) at the left and right ends of the black panel. They are partially "off-screen" on the black panel. But they display a portion of the next/previous page. One black panel is always not visible. When you click towards the dummy page, the black panel you don't see, shifts to an offset to cover the dummy with a real page. It's loaded with the four appropriate pages. When I click towards a dummy page, the not visible appears and the black panel scrolls to display the next or previous page. Since the black panels are identical and the page info is the same, you can't perceive the appearance of the alternate black panel. The illusion is complete. It gives the illusion the pages are in this large circle of continuous pages. When the pages scroll and the same cell is highlighted on another, it kinda gives away the illusion. So I want the highlight to move to the first cell once that page is off-screen. So it appears as though all pages are set to the first cell by default.
You have only yourself to blame. You asked. Happy Thanksgiving!
PepsiHog
edit - And yes, I AM cdo.(That's ocd in the correct order.)
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) 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!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) 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!