TSimpleGraph Issues (and wish list)

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

Postby HPW » May 13th, 2007, 8:29 am

I have a problem with a bug only in delphi5 when inserting a link in SimpleGraph 2.61:

Code: Select all
procedure TSimpleGraph.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  Pt: TPoint;
  NewObject: TGraphObject;
begin
  if not Focused then SetFocus;
  inherited MouseDown(Button, Shift, X, Y);
  Pt := ClientToGraph(X, Y);
  CheckObjectAtCursor(Pt);
  case CommandMode of
    cmInsertNode, cmInsertLink:
      if Assigned(DragSource) then
        DragSource.MouseDown(Button, Shift, Pt)
      else if (Button = mbLeft) and not (ssDouble in Shift) then
      begin
        NewObject := nil;
        case CommandMode of
          cmInsertNode:
            NewObject := InsertObjectByMouse(Pt, DefaultNodeClass, SnapToGrid xor (ssCtrl in Shift));
          cmInsertLink:
            NewObject := InsertObjectByMouse(Pt, DefaultLinkClass, SnapToGrid xor (ssCtrl in Shift));
        end;

      showmessage('MouseDown Hier1');

        if Assigned(NewObject) then
        begin
          NewObject.Selected := True;
          NewObject.MouseDown(Button, Shift, Pt);

      showmessage('MouseDown Hier2');

          if DragSource <> NewObject then
          begin

      showmessage('MouseDown Hier3');

            CommandMode := cmEdit;

      showmessage('MouseDown Hier4');

            ObjectChanged(NewObject, [gcData]);
          end
          else
            CursorPos := Pt;
          RenewObjectAtCursor(NewObject);
        end;
      end;
    cmPan:
      if (Button = mbLeft) and not (ssDouble in SHift) then
      begin
        fDragSourcePt.X := X;
        fDragSourcePt.Y := Y;
        Screen.Cursor := crHandGrab
      end;
  else
    if Assigned(ObjectAtCursor) and (CommandMode <> cmViewOnly) and
      (goSelectable in ObjectAtCursor.Options)
    then
      ObjectAtCursor.MouseDown(Button, Shift, Pt)
    else if  ((Button = mbLeft)
             and not (ssDouble in Shift)
             and     (CommandMode <> cmViewOnly))
             or
             ((Button = mbLeft)
             and not (ssDouble in Shift)
             and     (ssAlt in Shift)
             and     (CommandMode = cmViewOnly))
    then   {HPW commandmode check}
    begin
      fDragSourcePt := Pt;
      fDragTargetPt := Pt;
      MarkedArea := MakeRect(fDragSourcePt, fDragTargetPt);
      Screen.Cursor := crCross;
    end;
  end;
end;


Code: Select all
procedure TSimpleGraph.SetCommandMode(Value: TGraphCommandMode);
begin
  if CommandMode <> Value then
  begin
    if Assigned(DragSource) then
      begin
      showmessage('Hier1');
      DragSource.EndDrag(False);
      showmessage('Hier2');
      end;
    fCommandMode := Value;
    if not (CommandMode in [cmPan, cmEdit]) then
      SelectedObjects.Clear;
    CalcAutoRange;
    DoCommandModeChange;
  end;
end;


When I try to insert a link-line in EditMode starting at a empty area, I reach:
showmessage('MouseDown Hier3');

but only in delphi5 and not in delphi7!

In delphi 5 it reaches then SetCommandMode with:
showmessage('Hier1');
and throw an access vilation in:
DragSource.EndDrag(False);

Any ideas whats going wrong in D5 and how to workaround?
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » May 14th, 2007, 11:31 am

It seems to be a serious bug in Delphi 5 compiler. The problem is loosing address of fDragSource variable, that causes any access to fDataSource, generates an AV exception.

I couldn't find a workaround, sorry.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby HPW » May 14th, 2007, 11:39 am

Thanks for the info.

I can switch to delphi 7 but there I have still the problem with the tooltip shadows.

viewtopic.php?t=643&highlight=shadow

I have contacted the neobook author, if he could enable the shadow it the neobook host-app. Maybe then it would be removed properly.

Or can I disable the tooltip shadow somehow in my form, where I use TSimplegraph?
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » May 14th, 2007, 12:22 pm

The hint problem could be because of Delphi 7 XP theme manager. Did you check it?

The hints are managed by Delphi classes and SimpleGraph manages the hints as like as other controls.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby HPW » May 14th, 2007, 12:31 pm

The hint problem could be because of Delphi 7 XP theme manager. Did you check it?


No, where can I do it?
:oops:
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » May 14th, 2007, 12:37 pm

If your application had a reference to XPMan unit, the XP Theme manager is enabled.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby HPW » May 14th, 2007, 12:41 pm

If your application had a reference to XPMan unit, the XP Theme manager is enabled.


There is the problem, the application is neobook (where I have no control, but it has no shadows) and my plugin is only a form from a DLL running in neobook.

I found this code to enable the shadows in D5

http://www.swissdelphicenter.ch/de/showcode.php?id=1182

So maybe I can disabele it in my plugin code for D7.
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » May 14th, 2007, 1:08 pm

Yes, you can do it by offing the CS_DROPSHADOW bit.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby HPW » May 14th, 2007, 1:13 pm

The forum seems to have problem with double posts.

Yes, you can do it by offing the CS_DROPSHADOW bit.


How would I do that?
:oops:

In OnCreate of the form?
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » May 14th, 2007, 1:24 pm

HPW wrote:The forum seems to have problem with double posts.

No, it's because of my connection. :)

HPW wrote:
Yes, you can do it by offing the CS_DROPSHADOW bit.


How would I do that?
:oops:

In OnCreate of the form?

You have to create your own Hint Window class. Here is an example of such a class.

Code: Select all
type
  TNoShadowHintWindow = class(THintWindow)
  protected
    procedure CreateParams(var Params: TCreateParams); override;
  end;

procedure TNoShadowHintWindow.CreateParams(var Params: TCreateParams);
const
  CS_DROPSHADOW = $00020000;
begin
  inherited CreateParams(Params);
  Params.WindowClass.Style := Params.WindowClass.Style and not CS_DROPSHADOW;
end;

initialization
  HintWindowClass := TNoShadowHintWindow;
end.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby HPW » May 14th, 2007, 2:12 pm

Great thanks, I will give it a try in the evening.

By the way, will you remove the D5 compatibility sign on the TSimpleGraph product page now?
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby HPW » May 14th, 2007, 5:04 pm

Kambiz,

I tried it with D7 and now the plugin has a D5 compatibel tooltip!
Thanks again for the valuable tip.
Now I am working on a D7 based new release of the plugin for neobook.
The next feature will be to offer simple linklines as drawing lines for the canvas.
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » May 14th, 2007, 9:01 pm

HPW wrote:By the way, will you remove the D5 compatibility sign on the TSimpleGraph product page now?

It's done.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby HPW » May 15th, 2007, 5:30 am

But not on http://www.delphiarea.com/products/ !
:wink:

Are you sure that it works in D4/D6 ?
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » May 15th, 2007, 11:25 am

I could resolve the problem. The compiler was confusing with default parameters of InsertLink method.

I tested SG on D4, D5, D6, D7, and D2005.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

PreviousNext

Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest

cron