Recent

Author Topic: Form not refreshing while stepping through code  (Read 3056 times)

Noodly

  • Jr. Member
  • **
  • Posts: 70
Form not refreshing while stepping through code
« on: February 09, 2016, 07:14:28 pm »
Sorry if this is a basic question, but I couldn't find the answer by searching the forum or Google.

I've got the hang of using the debugger to step through code and watch variables and the fact that my application main form is frozen, even when a variable changes that should affect the display, hasn't been an issue until now.

I now need to see the form change as I step through the code and can only do this by adding in application.processmessages for every breakpoint. Is there a better way of doing this?

Many thanks in advance,
Noodly 
Windows 10 Home, Lazarus 2.02 (svn 60954), FPC 3.04

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Form not refreshing while stepping through code
« Reply #1 on: February 09, 2016, 09:20:53 pm »
no better way.

this is what happens in real live too. (maybe repaint in some cases)

forms only update between events, or when processing messages.

Code: Pascal  [Select][+][-]
  1. caption:='a';
  2. sleep(100000); // and caption update is delayed
  3.  

Noodly

  • Jr. Member
  • **
  • Posts: 70
Re: Form not refreshing while stepping through code
« Reply #2 on: February 09, 2016, 09:49:23 pm »
Thanks, I knew messages needed processing, but assumed the debugger would insert the relevant call just before each break point. Of course gdb is not particularly fpc aware so I shouldn't have assumed.
« Last Edit: February 09, 2016, 10:08:44 pm by Noodly »
Windows 10 Home, Lazarus 2.02 (svn 60954), FPC 3.04

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Form not refreshing while stepping through code
« Reply #3 on: February 09, 2016, 11:55:40 pm »
The debugger should never do that, ever if it could. That would modify the behaviour of your executable. Some apps may not even work, if the debugger did that.

Of course, ideally you should be able to explicitly tell the debugger to call a function (any function) when your app is paused, and then you could tell it to call application.processmessages.
But that is currently not possible at all.

The question is why do you need it?


 

TinyPortal © 2005-2018