Runtime key–to remove runtime marking from GTP.NET

When you run newer versions of GTP.NET you get a button in the date scaler:

image

To remove this button from your production system you need a runtime key.

Runtime keys are free for registered users of GTP.NET.

This is how you create a runtime key

Visit this site: https://licenseandticket.azurewebsites.net/

Find the runtime key menu:

image

Enter you key – choose product (GTP.NET) – Generate key – copy the resulting key

image

In your application code do something like this – do this BEFORE component creation. You only need to do it once per application:

        public WinForm()
        {
            RuntimeKey.Check.Register("YOUR-GTPNET-KEY==", "THE LONG GENERATED KEY FROM ABOVE =");
        }

 

FAQ: But why? It is not fair that some use the GTP.NET without sharing the cost of maintenance.
The runtime key makes it easier for all users to remember to acquire a license and help share the cost of maintenance.

Limit TimeItem change to whole days

        private void gantt1_OnTimeItem_Hoover(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
        {
            if (aGantt.MouseMoveKind == MouseMoveKind.move)
            {
                textBoxEvents.Text = "Moving a time item";
                DateTime suggestedStart=gantt1.DateScaler.PixelToTime(e.x);
                // but we do not accept the suggested start - we want it to differ in complete days...
                double totaldays=Math.Round((e.TimeItem.Start - gantt1.DateScaler.PixelToTime(e.x)).TotalDays);
                e.x = gantt1.DateScaler.TimeToPixel(e.TimeItem.Start - new TimeSpan((int)totaldays,0,0,0));
            }

Problems with Gantt_ASP Ajax

In IE10 and IE11 the coordinate system is all of a sudden in float numbers and not in integer as in all other browsers.

The AjaxControlToolkit has a GetElementPosition call deep down in it Common namespace that does some error checking.

The error checking it does is partly to verify that the coordinates it gets is of type integer – in IE10 and IE11 the will not be integers. Hence exceptions.

The error checking is only in effect when you have the scriptmanager in debug mode.

So to fix the errors you must do this:

          <asp:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server" 
CombineScripts="False" ScriptMode="Release"> <Scripts> <asp:ScriptReference Name="Common.Common.js" Assembly="AjaxControlToolkit" /> <asp:ScriptReference Name="Compat.DragDrop.DragDropScripts.js" Assembly="AjaxControlToolkit" /> <asp:ScriptReference Name="PlexityHideAjax.Gantt_AjaxBehavior.js" Assembly="PlexityHideAjax" /> </Scripts> </asp:ToolkitScriptManager>

 

Once you have done this – the moving of time items from client side works just fine once again.

Unwanted MouseMode

This article was written for phGantTimePackage VCL (Delphi XE5)

We got the question and a repeating sample to support that showed a scenario where the developer wanted to bring up a modal dialog in double click on a TimeItem.

All that is straight forward:

procedure TForm1.phGant1DblClickGantArea(theGant: TphGant_ComBasic;
  theDataEntity: TphDataEntity_GantTime);
var FrmModal:TFrmModal;
begin
  FrmModal:=TFrmModal.create(nil);
  try
    FrmModal.ShowModal;
  finally
    FrmModal.Free;
  end;
end;

 

The problem was that when the user did this double click and was in a resize hot-zone for the time item – the mouse mode Resize was entered and was still set when the modal dialog was closed.

My first response was to call the method MouseMoveModeCancel. This method is useful for programmatically end any current mouse mode.

However it turned out to not work in this case.

The reason for it not working was that after the DblClick event returns – VCL diretly fires the MouseDown once more – and this is where we actually entered the mouse mode.

In phGantTimePackage there is a way do dispatch a call to the windows message queue and this comes in handy here. The mechanism is called TDoLater and the solution looks like this:

 

procedure TForm1.phGant1DblClickGantArea(theGant: TphGant_ComBasic;
  theDataEntity: TphDataEntity_GantTime);
var FrmModal:TFrmModal;
begin
  FrmModal:=TFrmModal.create(nil);
  try
    FrmModal.ShowModal;
    TDoLater.DoLater(LeaveAnyUnintentionalMouseMoveMode,nil);
  finally
    FrmModal.Free;
  end;
end;

procedure TForm1.LeaveAnyUnintentionalMouseMoveMode(a:TObject);
begin
    phGant1.MouseMoveModeCancel;
end;

 

This way the defer the MouseMoveCancel to a time to directly after all the current messages that windows has on user interaction.

To use the TDoLater you need a uses for phDoLater.