10043 : Limit time item resize at given value

Question

is it possible to stop the user form moving or resizing a TimeItem while it is moving or resizing? (e.g. the lenght of the item has reached a limit so it cant grow more)

Answer

You can implement the event OnTimeItem_Hoover or OnTimeItem_Move, OnTimeItem_StartValueResize and OnTimeItem_StopValueResize.

In this event you can check e.Diff to find out how big change that has been made. If the change is to big by some standard, you can set the diff back to a legal value…

if (e.Diff>legal)
  e.Diff=legal

 

10044 : StartValueResize

Question

I’m trying to create an application using c# and your GTP.NET component. My problem is that I want to be able to cap the TimeItem dates to the nearest whole date. For this to work I want to set the modified dates when I receive an StopValueResize or StartValueResize event, but for some reason it wont work.

 

Answer

You can fix the change the e.Diff value. The diff is the amount of time the value will be changed with, if you set it to zero no change will be applied.

private void gantt1_OnTimeItem_StartValueResize(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
{
  e.Diff
}

But from what you describe you probably should take a look at PlexityHide.GTP.TimeItemLayout.SnapStartTime… This might be what you are looking for…

 

 

10041 : Context menu per time item

Question
I am developing an application that use your component GTP.NET under VisualStudio 2003
I cannot attach a ContextMenu in a specific TimeItem. It is possible how can I do it?
 

 
Answer
 
In the mousedown you can decide if the click is over a specific time item and then bring up your context menu;
 
I have this c# sample but it would be almost the same in VB, the important call is gantt1.TimeItemFromPoint(e.X,e.Y)
 
    private void gantt1_OnTimeItemAreaMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
    {
      if (e.Button==MouseButtons.Right)
      {
        if (gantt1.TimeItemFromPoint(e.X,e.Y)!=null)
        {
          GanttRow gr=gantt1.GanttRowFromY(e.Y);
          if (gr!=null)
          {
            menuItem1.Text=gr.GridNode.GetCell(0).Content.Value.ToString();           
            contextMenu1.Show(gantt1.TimeItemArea,new Point(e.X,e.Y));
          }
        }
      }
    }

10033 : Id like to put my own labels inside the headers of each column.

Question

Id like to put my own labels inside the headers of each column.
Is this possible?  How?

Thanks.

 

Answer

When you define you columns you set the Title property;

            GridColumn c_st=gantt1.Grid.Columns.AddNew(CellType.SingleText);
            GridColumn c_mt=gantt1.Grid.Columns.AddNew(CellType.MultiText);
            GridColumn c_td=gantt1.Grid.Columns.AddNew(CellType.TimeDate);

            c_st.Title=“SingleText”;
            c_mt.Title=“MultiText”;
            c_td.Title=“TimeDate”;

You can then control how the column headers are rendered by assigning CellLayouts. The simple way to assign a named CellLayout to the complete column is to set the gantt1.Grid.Columns.LayoutName to the name of an existing CellLayout in the Gantt.Grid.CellLayouts collection.

A more advanced way, that allows you to have unique CellLayouts all cells, including header cells, is to in runtime assign a CellLayout object the the Cell.Layout property. For header cells you reach the cell object via the Column object; GridColumn.ColumnCell.

You can also inject html code in the headers or in any cell by assigning them values with html snippets in them; like instead of col.Title=”the title” you can set col.Title=”<b>the title</b>”…

 

 

10039 : Combobox bug in v1.3.1

Question

I have a problem with the ComboText Cells.

My Version is GTP.NET 1.3.1 with VS 2003 an VB.NET.

Then i try to add a Value in a Cell or do anything (EditBox) with ComboText Style i receive a error

System.NullReferenceException

Code:

Private Sub grdPla_OnBeforeEditCell(ByVal grid As PlexityHide.GTP.Grid, ByVal beforeEdit As PlexityHide.GTP.BeforeEditEventArgs) Handles grdPla.OnBeforeEditCell

Dim ti As PlexityHide.GTP.ComboText

ti = beforeEdit.Cell.Content

ti.EditBox.Items.Clear()

ti.EditBox.Items.Add(“agsjhasg”)

ti.EditBox.Items.Add(“agsjhasg”)

End Sub

The same error exists in your own Grid Sample in C#.

Answer

Our mistake. A bug introduced in 1.3.1 causes this. Request pre-release at support@plexityhidemainsite.azurewebsites.net to quick-fix

 

 

10030 : Is it possible to indicate when a collision that spans across multiple time lines?

Question

Is it possible to indicate when a collision that spans across multiple time lines?  And then, is it possible to draw a large vertical stripe that extends from the top of the form to the bottom of the form, with the width of the conflict, indicating that particular time slot has a conflict in it?

Answer

There is no built in function for what you describe, but you can draw over the whole time item area using the Gantt.OnTimeItemAreaPaintBackground event. You can find each conflict by getting the result from the Gantt.OnCollisionDetect. And finally, one important function, you can translate from datetime values to current pixels with the DateScaler.TimeToPixel method.

 

 

10028 : It is possible to localize the Calendar (month & day) name in the GTP.NET? Thanks

Question

It is possible to localize the Calendar (month & day) name in the GTP.NET?
Thanks

Answer

The easiest way to localize the date and time related information is to assign a new culture setting;

 

    private void comboBoxCulture_SelectedIndexChanged(object sender, System.EventArgs e)
    {
      if (comboBoxCulture.SelectedIndex>-1)
      {
        dateScaler1.CultureInfoDateTimeFormat=new CultureInfo( comboBoxCulture.Items[comboBoxCulture.SelectedIndex] as string, false ).DateTimeFormat;
      }
    }

    private void Form1_Load(object sender, System.EventArgs e)
    {
      comboBoxCulture.Items.Clear();
      foreach ( CultureInfo ci in CultureInfo.GetCultures( CultureTypes.SpecificCultures ) ) 
      {
         comboBoxCulture.Items.Add(ci.Name);
      }

    }

 

10029 : disable clicking and dragging on the heading to adjust the zoom level of the Gantt chart?

Question

Can you disable clicking and dragging on the heading to adjust the zoom level of the Gantt chart?

We would need more control over the zoom level in the Gantt chart.

Answer

The event DateScaler.OnBeforeScaleOrSpanChange has been added for this purpose. The event Fires whenever the scale or shown intervall is changed by user interaction.

Example to stop panoration and zooming could look like this:

    private void dateScaler1_OnBeforeScaleOrSpanChange(PlexityHide.GTP.DateScaler dateScaler, PlexityHide.GTP.BeforeScaleOrSpanChangeArgs e)< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    {

      if (e.IsZoom && cbStopZooming.Checked)

      {

        e.NewStartTime=dateScaler1.StartTime; // Set new values back to current

        e.NewStopTime=dateScaler1.StopTime;

      }

 

      if (!e.IsZoom && cbStopPan.Checked)

      {

        e.NewStartTime=dateScaler1.StartTime; // Set new values back to current

        e.NewStopTime=dateScaler1.StopTime;

      }       

    }

 

Note: At publication date a patch download must be downloaded to access this new event. 

 

 

10027 : It is possible to host a windows user control in an Internet Explorer browser

Question

It is possible to host a windows user control in an Internet Explorer browser. I want to create a windows user control which make use of GTP.Gantt and host it in Internet Explorer.

First I tested the concept by dragging a treeview from the toolbox onto a windows usercontrol. Compiled it and included it on a ASPX webpage the following way:

<object id=”TestControl” height=”600″ width=”600″ classid=”http:test2control.dll#test2control.UserControl1” viewastext> </object>

It works perfectly.
I then created windows usercontrol and dragged a GTP.Gantt onto the usercontrol. But now it’s not possible to display the user control in the browser.

Is this a question of licensing or is it a question of reference?

Can you help me here?

Answer

UPDATE: YES We now have full understanding of all the trust issues invovled in this, and the GTP.NET has been adapted to be fully security aware. Look at the result: http://www.plexityhide.nu/IEHostedGantt/Default.htm This sample runs in the internet zone (zero trust).

<old answer below>

After you add the site to your trusted sites in IE, you need to change your security level for .NET code.

Currently to get the GTP.NET-usercontrol work this way you need to set it to Full Trust… You can adjust this setting by going to Control Panel – Administrative Tools – Microsoft.NET Framework Wizards 1.1 – Adjust .NET Security.

Note; This is not GTP.NET.WEB, in this case we actually want to download the GTP.NET to the client and host it within IE. In other words; not a Server side control….

Side note; Why we need “full trust” is not fully understood yet, will look into it, because it seems excessive.

Debugging Assembly Issues

If you’re getting an error when trying to use an assembly method, it’s most likely because the assembly object wasn’t created due to security issues.  One thing you can do is check the exception logs created by Internet Explorer.  You can find them in the Temporary Internet Files folder named “?FusionBindError!name=PlexityHide.GTP.dll “.  Drag this file to Internet Explorer or a text editor to read the exception and trace log. 

 

 

 

10025 : Collisiondetect

Question

I am interested in using GTP.NET for a Gantt chart like view of some data.  The only problem is, I would like the Gantt chart to display when there is an overlap in the tasks (a conflict) a vertical “stripe” that indicates where the overlap occurs.  Is this possible using your product?

 

Resolution

There is no simple property to set to achieve this, but you will probably be able to extend the functionality to solve this task.

First you need to implement the OnCollisionDetect event. This will signal whenever there is a collision detected or the collision previously detected is resolved. Then you will want to implement OnTimeItem_UserDraw to actually draw your special line at the point of conflict. In order for you to remember the time items that are currently in a colliding position I suggest that you keep a list of the TimeItems as a member variable in your form that has been signaled in OnCollisionDetect, and before drawing a time item in the OnTimeItem_UserDraw event you check if it is present in this list. Or you could make use of the UserReference property of the timeItem to put a new object with additional information that you need into the time item.

Note: in order to make the OnTimeItem_UserDraw event fire you need to declare the time items with the TimeItemLayout.TimeItemStyle=TimeItemStyle.User. When you do this you take complete responsibility for drawing the time item, if you want a mix of the user draw, and some standard style you can call the PlexityHide.GTP.TimeItemDraw.Draw method inside the OnTimeItem_UserDraw.