OnGanttToolDragBar

TeeChart for ActiveX, COM and ASP
Post Reply
gatsoft
Newbie
Newbie
Posts: 7
Joined: Tue Jul 26, 2005 4:00 am
Contact:

OnGanttToolDragBar

Post by gatsoft » Wed May 05, 2010 1:17 pm

Hi
Im trying to use the gannt drag and resize but also want to keep right click menus I have added. This is a Visual Foxpro application.
The problem I am having is a right click will give me the menu I require, but also continue moving the bar which I dont want. I only want drag and resize if the left click is down not the right click. I have tried setting the pointer.asgantt.allowdrag and allowresize in the seriesclick depending on the button but this does not seem to work.
Any advice please.
Regards
Allen

gatsoft
Newbie
Newbie
Posts: 7
Joined: Tue Jul 26, 2005 4:00 am
Contact:

Re: OnGanttToolDragBar

Post by gatsoft » Wed May 05, 2010 4:05 pm

I should have added this is using version 7 of the activex

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: OnGanttToolDragBar

Post by Narcís » Thu May 06, 2010 8:51 am

Hi Allen,

I've found this only occurs when you have disabled scrolling in your chart. You could either enable it or set a different mouse button for it. You'll find more information on how ot do that in tutorial 11. Tutorials can be found at TeeChart's program group.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

gatsoft
Newbie
Newbie
Posts: 7
Joined: Tue Jul 26, 2005 4:00 am
Contact:

Re: OnGanttToolDragBar

Post by gatsoft » Sun May 09, 2010 12:54 pm

Thanks for the reply. I had disabled scroll and zoom because I do not want it used. I have decided to have modes for the chart so the user can decide on the mode to use like the right click menu or move or zoom.
One other question, I can use the tools for moving in time, what is the best way to have drag drop in vertical, ie from one line to another rather than across the chart.
Thanks
Allen

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: OnGanttToolDragBar

Post by Narcís » Mon May 10, 2010 11:39 am

Hi Allen,

In that case you should try DragPoints tool.

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

gatsoft
Newbie
Newbie
Posts: 7
Joined: Tue Jul 26, 2005 4:00 am
Contact:

Re: OnGanttToolDragBar

Post by gatsoft » Tue Jul 06, 2010 10:02 am

Sorry for the delay, been very busy. I am now trying the drag point but it seems unclear what to do with it as it does not snap to the axis. At the moment I am just wanting drag style "Y" but it can leave the point (gantt) anywhere. I can see OnDragPointToolDragPoint but am unsure what to do with it. I need to use the new position to change the data. Any advice please or pointer to a demo
Thanks
Allen

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: OnGanttToolDragBar

Post by Yeray » Wed Jul 07, 2010 2:21 pm

Hi Allen,

I'm not sure to understand how you would like the points to snap to the axis. Here you have an example of how you could customize the Gantt series drag using the Mouse events. Note that this is a VB6 example.

Code: Select all

Dim MouseStartX, MouseStartY, clickedIndex As Integer

Private Sub Form_Load()  
  TChart1.Aspect.View3D = False
  
  TChart1.AddSeries scGantt
  TChart1.Series(0).FillSampleValues 10
  
  TChart1.Zoom.Enable = False
  TChart1.Scroll.Enable = pmNone
  
  clickedIndex = -1
  MouseStartX = -1
  MouseStartY = -1
End Sub


Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  clickedIndex = TChart1.Series(0).Clicked(X, Y)
  If clickedIndex <> -1 Then
    MouseStartX = X
    MouseStartY = Y
    TChart1.Header.Text.Text = Str$(clickedIndex)
  End If
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If clickedIndex <> -1 Then
    With TChart1.Series(0).asGantt
      .StartValues.Value(clickedIndex) = .StartValues.Value(clickedIndex) + TChart1.Axis.Bottom.CalcPosPoint(X) - TChart1.Axis.Bottom.CalcPosPoint(MouseStartX)
      .EndValues.Value(clickedIndex) = .EndValues.Value(clickedIndex) + TChart1.Axis.Bottom.CalcPosPoint(X) - TChart1.Axis.Bottom.CalcPosPoint(MouseStartX)
    End With
    
    TChart1.Series(0).YValues.Value(clickedIndex) = TChart1.Series(0).YValues.Value(clickedIndex) + TChart1.Axis.Left.CalcPosPoint(Y) - TChart1.Axis.Left.CalcPosPoint(MouseStartY)
    
    MouseStartX = X
    MouseStartY = Y
  End If
End Sub

Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  clickedIndex = -1
End Sub
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply