November 09, 2012

A Taste of Things to Come

While there’s not much going on in public, lots of talented people are working on the next Smart Mobile Studio release.

For a taste of things to come, here are two demos of the new component – TW3ListBox: ListBoxControl, ColorListBox.

First demo supports rearranging items by mouse/touch. Just click/press an item and hold the button/finger down for a second. An item will change color and you’ll be able to drag it to a different place.

While testing ListBoxControl you’ll notice that listbox items are not jumping around; they are softly sliding from a place to a place. You will also be able to create such interfaces by using a new animation unit. You can test the demo program for this unit here: ControlAnimation.

FYI, the code behind this demo fits on one 80x25 screen.

procedure TForm1.InitializeObject;
begin
inherited;
{$I 'Form1:impl'}
W3Button1.OnClick := StartMoving;
end;

procedure TForm1.StartMoving(Sender: TObject);
begin
W3Button1.Caption := 'Stop!';
W3Button1.OnClick := StopMoving;
var right := ClientWidth - W3Button1.Width;
var bottom := ClientHeight - W3Button1.Height;
Animation[W3Button1].Rotate(2000, 360, 0, Animation.Config.SetLoop(true));
Animation[W3Button1].Move(10000, [0, 0, right, 0, right, bottom, 0, bottom, 0, 0],
Animation.Config.SetOnCompleted(procedure begin StopMoving(nil); end));
end;

procedure TForm1.StopMoving(Sender: TObject);
begin
W3Button1.Caption := 'Click me!';
W3Button1.OnClick := StartMoving;
if assigned(Sender) then begin // not called from the end-of-animation handler
Animation[W3Button1].Stop;
Animation[W3Button1].Move(100, 0, 0);
if W3Button1.Angle = 360 then W3Button1.Angle := 0
else Animation[W3Button1].Rotate(100, W3Button1.Angle, 0);
end;
end;

No comments:

Post a Comment