10923 : I am trying out the ASP.NET samples it starts but I dont seem to be able to move the bars?

Question

I am trying out the ASP.NET samples; it starts but I don’t seem to be able to move the bars. Do you know what the problem is?

Answer

Your webproject should be Ajax-enabled (download and install from here http://ajax.asp.net/)

Place the Gantt_ASP in an UpdatePanel, and make sure that Gantt_ASP.ClientTimeItems is set to true.

When you have downloaded the ASP.NET set up and samples you can find the projects and source code here C:\Inetpub\wwwroot\GTP.NET.ASP.NET.AJAX\CompleteSource\LetsBuild_Web

10904 : I want to allow a user to move a timeitem between rows, but not to change the time

Question

I’m using the gantt control with ASP.NET. I want to allow a user to move a timeitem between rows, but not to change the time – just move it to another row at the same time as it was before being moved.  Is there a way to do this?

I think if the OnClientSideChangesApplied event returned a TimeItemEventsArg instead of just a plain event, it would be more helpful.

Answer

Actually you can do this in Gantt_ASP just the same way you would do it in windows forms:

In the pageLoad add this:

Gantt_ASP1.Gantt.OnTimeItem_Move +=

new TimeItemEvent(Gantt_OnTimeItem_Move);

and then implement the event like this:

  void Gantt_OnTimeItem_Move(Gantt aGantt, TimeItemEventArgs e)
  {
    if (e.NewGanttRow!=null && e.NewGanttRow!=e.TimeItem.GanttRow)
    {
      // The user wants to switch rows…
      //Ok, but lets zero the time move…
      e.Diff=TimeSpan.Zero;
    }
  }

You will need version 3.0.5.17 and above to get this to work smoothly

11013 : I want to increase and decrease the date scaler resolution manually on some buttons. Hows this possible… ?

Question

Hello support,

    I want to increase and decrease the date scaler resolution manually on some buttons. How’s this possible… ? It will help me if you provide the code.

Answer

private void ZoomMinus_Click(object sender, System.EventArgs e)
{
        gantt1.DateScaler.StartTime=gantt1.DateScaler.StartTime.AddDays(2);
        gantt1.DateScaler.StopTime=gantt1.DateScaler.StopTime.AddDays(-2);
}

private void ZoomPlus_Click(object sender, System.EventArgs e)
{
        gantt1.DateScaler.StartTime=gantt1.DateScaler.StartTime.AddDays(-2);
        gantt1.DateScaler.StopTime=gantt1.DateScaler.StopTime.AddDays(2);
}

This way we do it in Gantt_ASP, and it works better because it always zooms half of the span, no matter the current resolution…

      if (eventArgument == “scaleinc”)
      {
        TimeSpan ts=StopTime.Subtract(StartTime);
        ts=new TimeSpan(ts.Ticks/4);
       
        StartTime=StartTime.Subtract(ts);
        StopTime=StopTime.Add(ts);
      }
      else
      if (eventArgument == “scaledec”)
      {
        TimeSpan ts=StopTime.Subtract(StartTime);
        ts=new TimeSpan(ts.Ticks/4);
       
        StartTime=StartTime.Add(ts);
        StopTime=StopTime.Subtract(ts);
      }

 

11016 : Ajax samples source code

Question

 

Hello

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

I see that you have an Ajax web example in http://www.plexityhide.nu/ajaxdemo/Default.aspx, can I download the source code for this example? or can I download any similar example in GTP.NET 3.0 in web?

 

Thanks for all.

 

Answer

 

When you download GTP.NET for windows forms you get a menu item in the plexityhide GTP.NET start menu: “Download the ASP.NET and Ajax samples install”. Once you have downloaded the ASP.NET and Ajax samples and installed them you will find the complete source on your harddrive wwwroot: C:\inetpub\wwwroot\GTP.NET.ASP.NET.AJAX\CompleteSource

10894 : I do not get the OnTimeItem_BeforeMove event.

Question

Using the AJAX implementation of GTP.NET, I do not get the OnTimeItem_BeforeMove event. How am I supposed to know the amount of time a TimeItem has been moved in the AfterMove event?

What I want to do is to update all linked TimeItems on the right by the amount of time the moved one was changed.

Answer

The OnTimeItem_BeforeMove event if fired before the values are applied to Start and Stop of the time item. The amount moved is only available in the event arguments e.Diff.

You have the option to change the e.Diff value if you need to. Setting it to zero is an effective way of nulling out the move entirely.

Knowing this you can iterate the linked time items and add e.Diff to their start and stop properties (move backwards will give negative e.Diff values).

 

10899 : I am not finding a description for the event OnTimeItemLink_DoubleClick?

Question

 

I am not finding a description for the event OnTimeItemLink_DoubleClick(). Is there a workaround for this , possibly with OnTimeItemLink_SelectionChanged()?

 

Answer

 

You want to catch a dbl-click on a link?< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

You are correct we have no such event…

 

The workaround is to catch a normal-double click and see if that click started a mousemove operation that only comes if you click a link:

 

    private void gantt1_OnTimeItemAreaMouseDown(object sender, MouseEventArgs e)
    {
      if (e.Clicks == 2 && gantt1.MouseMoveKind==MouseMoveKind.linkReAssign)
      {
        gantt1.MouseMoveCancel();
        MessageBox.Show(“Hey, dbl click on link”);
      }
    }

Then we Cancel that started operation and bring up a dialog instead…

 

10729 : I want to hide a specific time item to do some filtering.

Question

I am using GTP.Net. I want to hide a specific time item to do some filtering. Which command should I use to achieve this.

Thanks

Answer

Currently we do not have a “Visible” property on TimeItem itself, so you must either remove the time item, or if you have them in a seperate layer you can set Visible=false on the Layer. The Layer class do have a Visible property.

 

10941 : How can I determine which rows are selected in the grid?

Question

How can I determine which rows are selected in the grid? It’s easy to determine which row is selected with:
owningTaskId := StrToInt((gantt1.Grid.FocusedCell.GridNode.ListItemWhenDataBound() as DataRowView).Item[‘id’].ToString)
but how do I determine which multiple rows are selected?

Answer

Often in gui controls like the GTP.NET there is a distinct difference between “select” and “focus”. The “thing” with focus can almost always be only one, and focus often mean keyboard-focus (where will the key-strokes go).

Selections can often consist of many “items”, often refered to as multi-select.

So in the grid there is only one Focused cell: gantt1.Grid.FocusedCell. And there are possibly many selected cells: ArrayList al=gantt1.Grid.GridStructure.SelectedCells();
You will need to iterate thru the list of selected cells and get to their GridNode just as you did with the focused cell.

Each Cell has a Selected property that is true or false. You can programatically set this if needed.

 

10939 : Tasks constraints

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />Question

 

Is it possible to manage task’s constraints with the GTP .Net 3.0 Component (ie: task1 begin after task 2, task 1 end when task 2 begin, task 1 start 3 month after task 4 etc… like with MS project) ?

And so, is-it possible to draw links starting from the start date of a task and joining the end date of another (with the demo I was only able to join task with end date from the first one and start date of the sconde one) ?

Answer

Task constraints are normaly part of your business logic and not a primaliry concearn for a GUI control, but we offer several events like OnTimeItem_AfterMove that you will want to implement to enforce your rules.

You can also use the TimeItemLinkActions that are available on each link. The LinkAction can be set to some simple rules on how to behave when a TimeItem changes: TimeItemLinkActions are executed when the time items in the link are changed (Start or Stop is changed). LinkActions can help you enforce some of the business rules that you want to stay in effect when the user changes time items

To control where the link is rooted you set the TimeItemLinkStyle property of the link to one of the values :

StartToStart Start of one time item to another time items start. 
StartToStop Start of one time item to another time items stop. 
StopToStart Stop of one time item to another time items start. 
StopToStop Stop of one time item to another time items start. 

10938 : The problem I have found is that my OnTimeItemAreaKeyDown event is not firing correctly…

Question

I have been using GTP.Net for a long time now in one of my apps. I just recently added the feature to move next or previous in the timeitems on the screen.

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

The problem I have found is that my OnTimeItemAreaKeyDown event is firing correctly, but only when I use my numeric pad left (4) or right (6).

 

If I use the regular left and right keys on my keyboard, the control does not seem to pick up the event has fired.

 

I have other controls on my form and they receive the left and right keys, but my GTP doesn’t.

 

Is there something I need to enable to make the left and right keys work?

Answer

I am not sure why some of your keys are working, I would have guessed that all or nothing should apply.

The main “GotYou” thing about catching keys in the time item area is to focus the time item area for key-input.

Implement a MouseDownEvent:

private void gantt1_OnTimeItemAreaMouseDown(object sender, MouseEventArgs e)
{
  gantt1.TimeItemArea.Focus();
}

Try again, this will now work as expected:

private void gantt1_OnTimeItemAreaKeyDown(object sender, KeyEventArgs e)
{
  label1.Text =
“DOWN “ + e.KeyValue.ToString();
}