Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: im killing delphi...

  1. #1

    im killing delphi...

    today i was ment to be working all day on a project of mine. well it started good then it went really bad, really fast.

    basicly what im trying to do is create a component (inherited from TPanel) for opengl work (please download here)

    when the component is created, i also setup the opengl rendering, please download the component and test app (made by TheLion in delphi 6) to see.

    with that code, my delphi ( 7 ) either causes an infinate loop of access violations, terminates without error, or compiles and installs.

    i CAN compile and run the test app (made by TheLion) without error. but when i try add a second TOpenGLPanel to the form i get a "Control '' has no parent" (or something like that).

    delphi crashed so many times today, its now at the top of my most used application list in the start menu

    i think i know what line is the problem, in uOpenGL.pas - Create - DC := GetDC(TWinControl(AOwner).Handle);

    with that code, i normally crash delphi, but with this code DC := GetDC(Handle); i get the error when i add it to the form

    if i use handle 0, no access violation, no error when adding to the form, but no opengl rendering

  2. #2

    im killing delphi...

    oh, ive also reinstalled delphi. that didnt fix it

  3. #3

    im killing delphi...

    Are you trying to draw within the panel only? Or the actual form?

    From what I know:
    DC := GetDC(TWinControl(AOwner).Handle);
    Gives the DC of the form.
    DC := GetDC(TWinControl(Self).Handle);
    Should give the panel's DC.

    If that doesn't work then I don't blame you! I'm going to kill dellphi soon anyway as well.

  4. #4

    im killing delphi...

    Are you creating the component in code or by dropping it on a form?

    If you creating the component in code, you must set the Parent property of the component. Note that this is different from the Owner that you pass to the Create() constructor. If I create a component in code, I always pass nil as the owner.

    MyComponent := TMyComponent.Create(nil);
    MyComponent.Parent := Panel2;

    Now MyComponent will be drawn as a child of Panel2.

  5. #5

    im killing delphi...

    im creating it by dropping it on a form.

    im trying to get the panel's dc yes, but changing the code didnt work.

    the error is "Control '' has no parent window" when i add it to the form

  6. #6

    im killing delphi...

    If I use the line:

    DC := GetDC(Handle);

    in Delphi 6, I can drop the component onto the form without a problem and after running it there is a rotating triangle on my panel. Eriken also tried it with his Delphi 7 Personal version and he doesn't encounter any of the problems Tux encounters with the same code. He can also read my test app in Delphi without getting any errors... If tux tries to open the same project he gets a few errors and when he tries to run it he gets Access Violations etc.! hehe

    strange stuff! hehe
    Do it by the book, but be the author!
    <br />
    <br />Visit the Lion Productions website at:
    <br />http://lionprod.f2o.org

  7. #7

    im killing delphi...

    Definatley sounds like Tux's Delphi installation has been corrupted somehow.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  8. #8

    im killing delphi...

    damn a reinstall didnt fix it. no other components cause this error

  9. #9

    im killing delphi...

    After looking at the component, I think the problem arises because you are trying to use and render to the DC at design time. It also crashes in my work's Delphi 6 IDE.
    I would suggest having a look at how they have done it in GLScene to get an idea on how to proceed. I think it will involve wrapping certain calls with a...

    [pascal]
    if not( csDesigning in ComponentState ) then
    begin
    .
    .
    .
    end;
    [/pascal]
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  10. #10

    im killing delphi...

    ill try it thanks

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •