Jump to content

Search the Community

Showing results for tags 'sho form'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 1 result

  1. alogrep

    Show a Form from inside a Thread

    HI. I hope someone can give me a hint here. Printque is a Form created in the Main Thread, just before calling this thread. Its Formcreate contains this line: Tstuckthread.Create(Tprintqueue(self),printernames); The problem is in the showform procedure at the line .A.show It gives no error, but the app becomes unresponsive. The main form is hidden, and I have to stop the app.I Tstuckthread= class(TThread) private FForm: TFORM; L:tSTRINGLIST; function STUCK(title:string;l:Tstringlist): boolean; procedure listjobs(allprinters: string); protected public constructor Create(ownerForm:TFORM;printernames:string; ARUNS: INTEGER=0); destructor Destroy; override; procedure Execute(); override; procedure showform; published end; constructor Tstuckthread.Create(ownerForm: TFORM;printernames: string;ARUNS: INTEGER=0); begin L:=tSTRINGLIST.CREATE; FForm:= ownerForm; Self.FreeOnTerminate := True; inherited Create; end; destructor Tstuckthread.Destroy; begin inherited; L.FREE; end; procedure Tstuckthread.Execute; begin done :=FALSE; while not Terminated AND NOT done do begin <get printjobs list and save it in L......> if L.count>0 then BEGIN /// fine HERE Tprintqueue(FForm).MEMO1.LINES.ASSIGN(L); // fine HERE Synchronize(SHOWForm); SLEEP(500); END; DONE:=TRUE; end; end; And here is the showform() procedure; procedure Tstuckthread.showform; VAR A: Tprintqueue; begin A:=Tprintqueue(FForm); TRY IF NOT A.VISIBLE THEN A.show; // PROBLEM HERE. EXCEPT a.free;// 4 testing. It never gets there. END;
×