Hi!
I'm working on a multimedia tool, and need a timeline such as the one found in Adobe After Effects and Flash. However, I have no idea how to do this... Any ideas/suggestions?
Thanks.
Hi!
I'm working on a multimedia tool, and need a timeline such as the one found in Adobe After Effects and Flash. However, I have no idea how to do this... Any ideas/suggestions?
Thanks.
BK - we.create (tm)
why don't you write your own?
it's not too hard. Create a new component (Components -> New) and make it a TCustomControl decendant. Then override the Paint procedure and draw your grid and that kind of stuff. You can handle OnMouseMove, OnMouseDown and OnMouseUp events (Self.OnMouseDown := MyMouseDownProcedure)...
Or if that's too much work for you, simply drop a TPaintBox onto your form and draw your timeline onto its canvas. TPaintBox publishes all significant mouse events, so dealing with that should be easy.
Ask me about the xcess game development kit
Thanks for the suggestions. Im now creating a paintbox based one. (I would prefer to write a component though, but I suck big time at components writing.. )
BK - we.create (tm)
I just desided to do a component, mainly because Im sick of re-inventing the wheel everytime I need a timeline. I started to "convert" my timeline from one of my projects to a component, but I suddenly hit the wall. I just need a coupple of hints. Im totally new to component dev, so the hints I need might be a bit silly.
1. I need to store a bitmap inside the component, like in a TImage.
I did a property using a TBitmap, but it doesn't seem to work.
Question is: how do you set default values on properties?
I've added the values in Create, but that doesn't change it in designtime.
2. The paint procedure in my component causes an access violation when the component is dropped to a form. Doesn't matter what I put in there. it's declared like this in the component:
protected
{ Protected declarations }
procedure Paint; override;
Also, how do you change the apparence of the component in design time?
Meaning, I would like the component to actually look like a timeline in both design and run time, instead of a gray area.
If someone could push me in the right direction, I would be most gratefull
BK - we.create (tm)
1.) First of all, if you have a TBitmap-property, any image stored in that property will be saved into the EXE file as long as that property is "published". Also, make sure to create the TBitmap in the constructor of your component.
If you want to store a TBitmap in your component that is either invisible to anything except your component or if you want to pre-assign a bitmap to a TBitmap property, use resources. You can create resources using the image editor that comes with Delphi or with the command line tool BRCC32 that you will find in the bin directory of Delphi. Component resources should have the extension DCR. They can be included just like any other resource using the compiler directive {$R blah.dcr}. To load bitmaps from a resource, try this:
Bitmap.Handle := LoadBitmap(HInstance, 'MYBITMAP');
2.) When you drop your component onto your form, two methods are executed, the constructor and the paint procedure. If your constructor fails then maybe because you're trying to access canvas functions before the canvas has been created, if your paint procedure fails then maybe because you're accessing bitmaps that haven't been created... make sure that's not the case and report back if that doesn't fix it.
3.) The reason why you're not seeing anything is probably because your paint procedure doesn't work. Other than that, there is no reason why your component should be just a grey rectangle. You might want to check out the "ComponentState" property if you need to distinguish between design- and runtime.
If you're still having problems, post some code and I might be able to help
Ask me about the xcess game development kit
Thanks for the replies
I can't figure out the constructor.. It currently looks like this:
[pascal]
constructor TTimeline.Create;
var
x,y,y2,x2: integer;
begin
//inherited;
FGridSize:=16;
FWidth:=200;
FHeight:=200;
SetLength(SequencerMap,FHeight+1,FWidth+1);
y2 := Divide(FHeight, FGridSize);
x2 := Divide(FWidth, FGridSize);
for y:=0 to y2 do
for x:=0 to x2 do
SequencerMap[y,x]:=-1;
end;
[/pascal]
It won't execute at all. I guess it's possibly due to the inherited I've commented out, but I've tried using it in every possible variant without luck. (Oh, and I'm not using a bitmap anymore, so thats why there arn't any bitmap stuff in the creator )
BK - we.create (tm)
The declaration of your constructor should look like this:
[pascal]constructor Create(AOwner: TComponent); override;[/pascal]
and the implementation should look accordingly (you're missing the owner). Also, you will need the "inherited" in exactly the position where it is now.
Ask me about the xcess game development kit
It's always those little things.. ops: works like a charm now (off course).
BK - we.create (tm)
I made a timeline for some animation software I'm writing.
http://atlas.walagata.com/w/peterbone/Pivot.zip (no source)
The timeline is not like flash because it actually displays the frames as small images for easier navigation. I used TImages inside a TScrollBox. This makes it easy for frames to be inserted or deleted because you just change the positions of the images when 1 is deleted/inserted instead of having to redraw them all. I use the OnClick event of the TImage to select a frame - each TImage has it's tag value set the the frame number so it can tell which image was clicked.
Maybe you don't want this kind of timeline, but I thought I'd mention it anyway.
Peter
Bookmarks