Archive for the ‘components’ Category.

Introducing Demo Browser… (from the pile of never to be released…)

It is interesting what you find in your drafts folder. From January 20, 2012! I guess my interests got consumed elsewhere. Still think the idea has merit.

I’m sure everyone has a stack of ideas that never really get off the ground for one reason or another. This is just one of plenty for me!

NOTE: This was used for the JSDialog Pack demos way back when so it kind of got released for in-house use.


The Demo Browser is an application that allows component vendors to showcase the demos that come with their products.

One of the main issues developers face is how to make “my application” do what is being done in a screen shot shown on the particular vendors site. I know this because I am also a consumer of third party products and trying to work out how a component works can be time consuming. The aim of Demo Browser is two fold, firstly allow a products demos to be located in a common front end and secondly to help spotlight important features within those demos.

The idea originally came about when seeing a number of questions about Delphi specific features that were covered by sample applications that shipped with the product. It is fine to tell them to go and search through a bunch of directories (some Delphi versions he “hide” the demo folder is some obscure location – it has since become more obvious where the demos are, but I digress).

So a central location for demos is what Demo Browser is.

Some History

Like most things I develop I usually mention it to a number of people I consider my sounding board. They seem to be very good at determining what might be a good thing and what may not (even though we don’t always see eye to eye – which is a good thing). I first bounced the Demo Browser idea off a former Borland (yes a while ago now) employee whom I had coffee and social chats with on a regular basis. So the first Demo Browser prototype was dynamic. It could read in the demos folder of your Delphi installation and process the information into a nice central view. Here are some of the initial screen captures (these were created August 3, 2007).

Demo Browser prototype

Demo Browser: summary

Demo Browser: readme

Demo Browser prototype

Demo Browser: screen capture

Demo Browser: filtering

Demo Browser prototype

Demo Browser: filter view

Demo Browser: video

FireMonkey – TArc and Retina, not the best of friends

Last week I noticed a post on www.fmxexpress.com that showed a different UI for a progress bar. So instead of starting work on something I should have, I turned the code into a component and added the ability to change the colours used when displayed.

I’d known TArc didn’t render nicely on a Retina device because I was using it to render a navigation UI concept. Which I’ve had to shelve because of this issue.

The control does look good under other platforms (untested under Android – issues not anticipated though).

You can download the full source code for the control from the Quality Central report lodged for the rendering issue. It looks like you will need to use a native client to download from the QC report as it doesn’t look like you can from the web client.

The control has the following “license” in the main unit:

{

TCircleProgress is based on code made open source by developer OneChen.

Original Code Link: https://github.com/OneChen/ProgressCircle
How I found out link: http://www.fmxexpress.com/build-a-progress-spinner-using-objects-in-delphi-xe6-firemonkey-on-android-and-ios/

Developer of this component: Jeremy North (jeremy.north@gmail.com)

DO NOT PAY FOR THIS COMPONENT. DONATE TO THE ORIGINAL AUTHOR OF THE IDEA IF YOU WANT TO CONTRIBUTE.

Disclaimer: This code is provided free of charge, bugs and all.

}

 

Windows

 

The Windows capture actually shows another drawing bug with FireMonkey. Notice how the rectangle at the top has two black dots in the top left and top right corners. This happens when you eliminate sides from a rectangle and maintain one full side to be drawn. Something that I’ve reported previously.

Report No: 122616 (RAID: 47827) Status: Open
Removing Sides can leave unwanted dots in corners
http://qc.embarcadero.com/wc/qcmain.aspx?d=122616

 

OS X

 

iOS

 

NOTE: This isn’t an issue for just TArc though, it is an issue with the GPU canvas. In previous versions, you could disable the usage of the GPU canvas, however with XE6 – the option to switch it off has been deprecated.

 

Zoomed view under iOS

 

Report No: 126186 (RAID: 52756) Status: Open
[Retina] [iOS] TArc doesn’t rendering nicely on a Retina device
http://qc.embarcadero.com/wc/qcmain.aspx?d=126186

 

Reported and opened. Hopefully in the next release, this rendering issue is addressed.

FireMonkey: Extending TFloatAnimation to support maximum loops

Background

In response to a QC report I wrote early last year I decided to implement a LoopCount property on the TFloatAnimation component.

Report No: 105140 Status: Open
Add a LoopCount property to the TAnimation class
http://qc.embarcadero.com/wc/qcmain.aspx?d=105140

Class Definition

  TJSCustomLoopCountFloatAnimation = class(TFloatAnimation)
  public
    type
      TAnimationLoopEvent = reference to procedure (Sender: TObject; const LoopNumber: Integer; var Cancel: Boolean);
  private
    FLoopCount: Integer;
    FCheckingLooping: Boolean;
    FOnLoop: TAnimationLoopEvent;
  protected
    FLoopsComplete: Integer;
    procedure FirstFrame; override;
    procedure DoLoop(var ACancel: Boolean); virtual;
    procedure ProcessAnimation; override;
  public
    constructor Create(AOwner: TComponent); override;
    property LoopCount: Integer read FLoopCount write FLoopCount default 3;
    property OnLoop: TAnimationLoopEvent read FOnLoop write FOnLoop;
  end;

Nothing that interesting in the new descendant. New property called LoopCount to control the number of loops and a new event that gets triggered each time a loop completes.

The published component publishes the new property and event but also changes the default values for two existing properties. It makes sense to set Loop to true when the new class is for enhancing the looping ability and if you’re looping, generally AutoReverse will be set to true.

  TJSLoopCountFloatAnimation = class(TJSCustomLoopCountFloatAnimation)
  published
    property AutoReverse default True;
    property Loop default True;
    property LoopCount;
    property OnLoop;
  end;

Implementation

I won’t post all of the code here because you can download from the link provided below, just a couple of snippets.

We need to override the FirstFrame method to initialise a couple of variables we use.

  • Checking to see if the LoopCount property is valid (raise an exception if it isn’t)
  • Initialise the variable to zero that counts the interactions
  • Make sure we are going to be checking the animation process for loops

Most of the work occurs in the overridden ProcessAnimation method.

procedure TJSCustomLoopCountFloatAnimation.ProcessAnimation;
var
  LCtx: TRttiContext;
  LType: TRttiType;
  LField: TRttiField;
  LCancel: Boolean;
begin
  inherited;
  if FCheckingLooping then
  begin
    LType := LCtx.GetType(Self.ClassInfo);
    if Assigned(LType) then
    begin
      LField := LType.GetField('FTime');
      if LField <> nil then
      begin
        if LField.GetValue(Self).AsExtended = 0 then
        begin
          Inc(FLoopsComplete);
          LCancel := False;
          if FLoopsComplete > 1 then
            DoLoop(LCancel);
          // The first time through, FTime is 0 so we need to offset this by
          // adding 1 when checking for completion
          if LCancel or (FLoopsComplete = LoopCount + 1) then
          begin
            LField := LType.GetField('FRunning');
            if LField <> nil then
              LField.SetValue(Self, False);
          end;
        end;
      end;
    end;
  end;
end;

Thanks to extended RTTI we can access a couple of private fields that we need to determine if a loop has been completed. This occurs when the FTime variable is zero. There is one issue with using this value and that is that the first “Loop” should be ignored since the first time ProcessAnimation is called FTime is zero so by the logic used, a loop has completed. This is why the DoLoop method is only called if the FLoopsComplete variable is greater than one.

Naturally it is possible to handle this one-off situation differently using a “First Time Through” variable but under the circumstances, I decided to go with the solution in place.

Once the LoopsComplete value is one greater than the LoopCount (refer to the above two paragraphs if you’ve already forgotten about why) the private field FRunning is set to False. Setting FRunning to false, stops the animation immediately.

Why not just call the public Stop method instead of going to the trouble of setting a private field? The answer to that is found in the ProcessTick method of the animation control (incidently, why isn’t this method virtual?).

  ...
  ProcessAnimation; // <==== We set FRunning to false here
  DoProcess;

  if not FRunning then
  begin
    if Assigned(AniThread) then
      TAniThread(AniThread).FAniList.Remove(Self);
    DoFinish;
  end;
  ...

By setting FRunning to false within our ProcessAnimation override, we are avoiding another frame being processed before the animation is stopped. This is because the Stop method calls ProcessAnimation and DoProcess as well.

Download

You can download the component and a cheesy demo application from the link provided. There is no package for the component to install it into your IDE, this is left as an exercise for the reader :-).

Loop Animation Demo (short video – 39KB)

Download LoopCount Component and Demo

NOTE: Before downloading the source code you must agree to the license displayed below.

License Start

This space intentionally left blank…

License End

JSDialog Pack 2.0.021

A new version of JSDialog Pack was sent to customers earlier this month. If you haven’t received your Delphi XE3 compatible version of JSDialog Pack, let me know.

 

Release History

October (2.0.021)

– Add support for Delphi XE3
– Make non-modal dialog sheets move when the form is being moved or resized
– Fix combo box items not being set when default values specified
– Fix non-native progress bar state colours being incorrect

 

License Change

Like XE Plus Pack, JSDialog Pack as had a license change where new licenses are now lifetime licenses with no more to pay. You will continue to receive each new version with no additional payment. This is retrospective for the past 18 months of purchases. If you think you fall into this category, send me an email from the account used for the purchase.

For those that had been customers previously and decided not to renew, but would like to, contact me and we’ll work out the top up fee.

New licenses with lifetime support and upgrades are available for 90 Euros.

FireMonkey Style – TStyleTag

There appears to be an oversight by Embarcadero with the TStyleTag component not being registered for use.

TStyleTag is a handy little component that allows you to add it to a style definition and have it store an Integer, Float or String value. This is used in some of the default styles, one place being the TTrackBar where it is used to hold the default thumb size of the track item.

This allows you to retrieve the thumb size depending on the default style (Windows or Mac) and adjust your user interface depending on the value.

TStyleTag Component

I’ve created a package that your can compile and install into the IDE to register this component.

Download Package

The component doesn’t have to only be used in a style definition, you can drop it directly on your form if you have a use for its functionality.

NOTE: While the component is used in the default Windows and Mac styles, it doesn’t seem to be used in the other FireMonkey styles. Although I did only look in a couple of them. Perhaps something that will be address in an update.

 

 

XE3 Plus Pack

XE3 Plus Pack is now available for download.

 

This version supports XE3 and includes a new expert (detailed below), some minor enhancements plus some fixes.

– New expert called Watch Property Groups.

– The Bookmark Guide expert now defaults to suppressing editor bookmarks and aligning to the left of the editor.

– When displaying Options, the Visual Forms window is no longer displayed when not visible.

– When returning from viewing a form as text and there are errors treaming in the form an exception dialog would display repeatedly.

– Support Visual Forms captures for FireMonkey projects (the underlying structure of the form designer changed between XE2 and XE3).

– Logging Visual Forms messages would raise an exception on shutdown when the message view was not visible.

– Fix issue with Bookmark Guide not displaying when loading the IDE with no project.

– New command to automatically jump to the Library Paths options page. Add it to the IDE by customizing a toolbar.

 

Download

Download the 30 day trial – XE3 Plus Pack Trial Download

 

XE2 Plus Pack users

XE2 Plus Pack registration details also work with XE3 Plus Pack. Therefore there is no need to purchase XE3 Plus Pack if you are an existing XE2 Plus Pack customer.

 

Pricing change

The price for XE3 Plus Pack is still only 40 Euros and now includes a lifetime license. This change also applies to existing XE and XE2 Plus Pack holders.

 

Watch Property Groups

The Watch Property Group expert allows you to group a number of properties you generally watch for a specific object type and adds them all to the Watch List with a click of a button.

Watch Property Group

Steps Involved

  1. Define your property group
  2. Highlight the object instance in the code editor and display the Watch Property Group window. The default shortcut is Ctrl+Shift+W.
  3. Highlight the desired watch group to use and press enter (or the first toolbar button) in the Watch Property Group dialog to add a watch for each property in the defined group.

The Watch Property Group window can be docked in the IDE and saved to your debug layout so it is always where you want it.

Additional Information available in the online help guide: http://www.jed-software.com/help/WatchPropertyGroup/WatchPropertyGroup.html

 

XE Plus Pack – Release 8 (XE and XE2 versions)

A new release of XE Plus Pack is now available to download.

 

For Delphi XE – http://www.jed-software.com/files/XEPlusPackTrial.zip

For Delphi XE2 – http://www.jed-software.com/files/XE2PlusPackTrial.zip

NOTE: Update 4 must be installed for the Delphi XE2 version.

 

Available Experts

XE Plus Pack is a collection of IDE Experts, component editors and property editors available for either Delphi XE or Delphi XE2.

Currently XE Plus Pack consists of eight experts:

  1. Visual Forms (previously available as a separate product)
  2. Activate Project
  3. File Actions
  4. Remember IDE Tree Options
  5. Find Bar Alignment
  6. New Code Template
  7. Bookmark Guide (new in Release 6)
  8. Resolution Selector (new in Release 6)
  9. Mouse Scroll Form Designer (new in Release 8 )
  10. Structure Pane Enhancements (new in Release 8 )
  11. Help Shutdown (shutdown DExplorer.exe on IDE shutdown) (new in Release 8 )

 

Mouse Scroll Form Designer Image Mouse Scroll Form Designer

When the designed form gets too large to fit within the bounds of the embedded form designer, simply use the mouse wheel to scroll the hidden portion of the form into view.

  • This feature supports vertical and horizontal scrolling.
  • Hold down the control key to scroll horizontally if your mouse only supports vertical scrolling.

NOTE: In XE2, this expert doesn’t always work correctly with the FireMonkey designer. The FireMonkey designer doesn’t play very nice with the IDE and has a number of quirks and inconsistencies. I will continue to investigate making this work nicely in future releases.

 

Structure Pane Enhancements Structure Pane Enhancements

This expert has been totally driven by an XE Plus Pack user and would prove especially helpful for other users that use the Floating Form designer layout. This experts helps fix a number of deficencies when dealing with using the structure pane with the floating form designer.

  • Add an editor shortcut key combination to collapse the content of the structure pane.
  • Optionally make the structure pane the active window after the collapse has occurred.
  • Collapse the structure pane when navigating between source code editors.
  • (IDE BUG FIX) When using the floating form designer, make sure the source editor structure view is available when moving between the designed form and the source editor for the form.

 

Structure Pane Enhancements Help Shutdown

Makes sure the help system is shutdown when the IDE is closed. All instances of “dexplore.exe” are terminated.

 

What’s coming up

Release 9

  1. Options Import/Export utility.
  2. Path property editor for FireMonkey

Expected release date – July/August 2012

Release 10

Two new experts will be introduced.

  1. Smart Desktops
  2. Watch Property Groups

Expected release date – August/September 2012.

Disclaimer: Dates and features mentioned for upcoming versions may change.

JSDialog Pack 2.0.019

A new version of JSDialog Pack is now available to registered users with valid maintenance. If you haven’t received an email with the latest version – please contact me.

 

Highlighted Additions

This new version includes support for updated progress bar usage on the task bar under Windows 7.

New progress ShowOnTaskBar property

New ShowOnTaskBar property

Also included are new wrapper methods:

  • New overloaded version of VerifyMessage to support footers. (Declared in JSDialogs.pas)
  • New InputQueryVerification method which displays an input query style dialog with the verification checkbox visible. (Declared in JSEditDialogs.pas)
  • Also it is now possible to use your custom TJSEditDialog descendant for use in the edit dialog wrapper methods. Just set the new JSEditDialogClass variable in the JSEdtiDialog.pas unit to your new descendant.

 

Change Log

  • Add ability to display progress on the task bar under Windows 7
  • Fix memory management issue with non-modal dialogs
  • Fix unique name clashes
  • Support retrieving a button on the dialog by using its expected result value
  • Make sure dialog is updated when the glyph property is changed
  • Make sure using the SetProgressState method to change the state of the progress bar updates the progress bar in the dialog and also on the task bar
  • Change the UpdateProgress methods to functions that return the current value of the progress bar after being updated
  • Improve color usage in custom styled applications
  • New overload of the VerifyMessage wrapper method to allow setting footer information
  • Allow setting of the EditValue property in TJSEditDialog descendants
  • New event OnSetEditValue for TJSEditDialog descendants
  • Support opening files (prefix content location with “file” instead of “http“) when using the EditType of etHTML
  • New wrapper method InputQueryVerification that displays an InputQuery dialog with a checkbox on it
  • Allow specifying a default TJSEditDialog class to be used when invoking one of the TJSEditDialog wrapper methods. Set the JSEditDialogClass variable to change the default class.

 

 

18% off JSDialog Pack

In celebration of my daughter turning 18 in a few days, we are offering 18% off JSDialog Pack orders.

Just use the coupon code MADDIE18 to get the discount.

http://www.jed-software.com/jsd_purchase.htm

Just in time for the next release, which will occur before June.

http://www.jed-software.com/jsd.htm

Ribbon – using a ribbon style for a normal menu

Recently the following QC report was created:

Report No: 102419 (RAID: 289385)          Status: Open
RibbonStyleActnCtrls: No dropdown arrows of Actiontoolbar buttons
http://qc.embarcadero.com/wc/qcmain.aspx?d=102419

I noticed it and included the changes necessary to make it work. Since the ribbon functionality uses additional properties on TActionClientItem, these can be set for normal menu items to get the desired outcome. These additional properties are ignored by existing styles.

An alternate solution is a source code change that is also documented on the report. This source code change is not interface breaking, so you just need to copy the modified file into your applications folder.

 

As noted on the report, a ribbon style won’t work if the user selects the option in the ActionManager to use “large” images. This is due to the large button size on the ribbon being three times the height of a small button, instead of two that the ActionManager expects.