I just had to say that based upon the subject line of your message
my rules automatically threw your message into my Sex and Spam box.  I
always do a quick view of it before emptying just in case I come up with
something like this, but it was the combination of those two words, "gaps"
and "gasp" that caused it to be flagged!! <G>  Actually had I not had a
system like this set up already I probably wouldn't have looked past the
subject myself anyway because it rings of that nature.  I'm sure I'm not the
only one with rules for things of this nature so it might be a good idea for
all of us to be a little more careful in how we describe the contents of our
messages! <g>

from: Robert Meek at: [EMAIL PROTECTED] 
dba "Tangentals Design" home of "PoBoy"
freeware Windows apps and utilities
located at: www.TangentalsDesign.com
Proud to be a moderotor for the
"Delphi Programming Lists" at: elists.org 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Richard R
Sent: Thursday, September 22, 2005 8:04 PM
To: 'Delphi-Talk Discussion List'
Subject: Re: gaps makes me gasp

I solved the problem, heh I musta been tired to not see this before. The 
TPanels were on a TScrollBox which had a scrollbar. When the scrollbar was 
at position > 0, the TPanels created would be placed incorrectly. So all I 
had to do is set the position to 0 then set the bounds on the TPanels. The 
control works like a charm now =)

----- Original Message ----- 
From: Richard R
To: 'Delphi-Talk Discussion List'
Sent: Tuesday, September 20, 2005 9:12 AM
Subject: gaps makes me gasp


I am developing a custom control that creates a gradient from 1-255 colors. 
My design works out great but there is a problem. I recently added a "Add" 
and "Delete" function to this so users can add and delete colors. However 
the placement of each TPanel containing the color is getting wacked out. It 
seems that after 5 or 6 color panels are created, the last panel get placed 
with a huge gap from the previous one and I dont know what is causing it. 
The formula to place the panels nice and neet is asize * idx + 2, it works 
out for a few panels then starts making huge gaps, any suggestions?

procedure TtsxGradientBar.AddColor(Sender: TObject);
var
  asize, idx: integer;
begin
  if (FNbrColors = High(Byte)) then
    exit;
  asize:= 0;
  // 25 is the width or height of the scroll bar depending on orientation
  case Orientation of
    dVertical:
      asize:= FScrollBox.Width - 25;
    dHorizontal:
      asize:= FScrollBox.Height - 25;
  end;
  idx:= FNbrColors; // current number of colors (or tpanels)
  FNbrColors:= FNbrColors + 1; // increase the number of colors and tpanels
  SetLength(FPanels, FNbrColors); // increase size of the tpanel array
  FPanels[idx]:= TPanel.Create(FScrollBox);
  FPanels[idx].Parent:= FScrollBox;
  FPanels[idx].ParentColor:= False;
  // this is where i run into a problem. About 5 to 6 tpanels are properly 
aligned but any more and
  // a huge gap gets placed between the last panel and the previous one. Any

suggestions?
  case Orientation of
    dVertical:
      FPanels[idx].SetBounds(2, idx * asize + 2, asize, asize);
    dHorizontal:
      FPanels[idx].SetBounds(idx * asize + 2, 2, asize, asize);
  end;
  FPanels[idx].Color:= RGB(Random(255), Random(255), Random(255));
  FPanels[idx].Caption:= '';
  FPanels[idx].OnMouseDown:= pMouseDown;
  FPanels[idx].OnMouseUp:= pMouseUp;
  MakeGradient; // this just creates an array of colors of the gradient 
effect
  Paint; // this paints a preview of the gradient effect on the main control
end; 
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to