Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

THyperGrid 3Easy , 1Medium, 1Hard

Hello,

I am using D2.
I have found the freeware component THyperGrid v1.35 at www.neosoft.com/~pablo. It has no help documentation.

Q1a. Is there any 'DETAILED' help documentation out there?
     YES - Where do I get it?
     NO  - Can you look at the code and tell me (all - if              possible)the methods? I know how to do this at              design-time, but I would like it to change to a             response at run-time.
           eg. I would like to change text color in a cell.
           Please give example:  HyperGrid1.....
Q1b. I am using the EditMask in THyperGrid (it acts similiar      to TStringGrid), a problem I have with numbers in that      I say I want to limit a number to 4figures eg 1224          and all I want to type in is 124 => the result is           124_ (where_ is a blank against the grid margin) my         mask is '9999;1'; How do I get around this? (maybe      mask isnt the right thing to use is there something      else?)

Q1c. I am using real numbers in the THyperGrid and want to      mathematically check the values for what ever reason -      Should I use LongInt or what?

Q1d. I want to remove trailing zeros from a text string -        how?

Q1e. I want to print a string of 'random' length to a file.      The string in this case may be 3 characters long and I      want it to right justified to tab position 25.
         123456789012345678901234567890
     eg.                       645
   
0
Ham
Asked:
Ham
  • 2
1 Solution
 
ZifNabCommented:
Q1A : By my thought there is no detailed help file available.
You can find all the information of that component with the Browser (from menu View) Once you've run your program with a THyperGrid. Search for THyperGrid and you'll get more information than you want (all virtuals, published, protected, ...). (Just type in THyperGrid)

e.g. :

{Next makes the 10 Columns read-only}
for i := 0 to 9 do
     HyperGrid1.Columns[i].ReadOnly := True;
{Next puts text in a cell}
HyperGrid1.Cells[1,1] = 'Hello, world!'
{Next changes column color}
HyperGrid1.Column[1].ColumnColor := clInfoBk;

...

If this isn't what you're looking for, please clarify your problem.

Q1b. Don't know exactly, but what about Right justified the column?

Q1c. Please clarify problem. LongInt (is Type for whole numbers, like 1 2 3 4 5; and is big brother of Integer) Real is for floats (like 1.1 2.3 5.6) If you will work with floats and whole numbers, than you have to use type real or double. If you are sure that you will ONLY use whole numbers than you have to use smallInt, Integer or LongInt depending on the range. Search for Type in delphi help and you'll know what I mean.

Q1d.

var Text1 : string;
    i    : integer;

 i := 0;
 while (Text1[i]='0') and (i <> length(Text1)) do begin
  inc(i);
 end;
 Delete(Text1,0,i);

I'm sure, there are better ways to do it, look at the string-handling routines. For trimming spaces and so, you can use the trim functions.

Q1e.
const TotallengthPage = 30;

function RightJustify(Text1:string;Pos:integer):String;
var i : integer;
begin
 For i := 0 to TotalLengthPage-Pos-length(Text1) do
  Text1 := ' '+Text1;
end;

Comment : Sure, there are much better ways to do it, but I wanted to show it you in the simplest form. Hope you'll be able now to make it better yourself!

Hope I could help you with this information. If not, sorry, ask again or ask Pablo (about THyperGrid). He helped me a lot.

Have fun,
c.u. ZifNab;



0
 
ZifNabCommented:
Was everything clear for you?
If not, give me a comment and I'll see what I can do!

Have fun,
c.u. ZifNab;
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now