Show indexing progress

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Show indexing progress

Post by cocoking »

TYVM, mrduck, for your suggestion.

Sorry, I do not understand what you mean by "DO EVENTS". Please elaborate.
Please bear with me, this is the first time I'm working with HMG.
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: Show indexing progress

Post by mrduck »

cocoking wrote:TYVM, mrduck, for your suggestion.

Sorry, I do not understand what you mean by "DO EVENTS". Please elaborate.
Win32 needs time to process the message queue (that contains orders to update the video) but if you are in a tight loop the queue handler never kicks in.
So, during long processes, you must give win32 the opportunity to process the queue, and it is done (according to hmg manual) with the DO EVENTS command....

should be something like this:

object:Value = "index 1"
do events
index on......
object:Value = "index 2"
do events
index on....
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Show indexing progress

Post by Roberto Lopez »

cocoking wrote:TYVM, mrduck, for your suggestion.

Sorry, I do not understand what you mean by "DO EVENTS". Please elaborate.
Please bear with me, this is the first time I'm working with HMG.
It process pending messages:

Code: Select all

HB_FUNC( _PROCESSMESS )
{ 
  MSG Msg;
  
  if( PeekMessage((LPMSG) &Msg, 0, 0, 0, PM_REMOVE) )
  {
     TranslateMessage(&Msg);
     DispatchMessage(&Msg);
     hb_retl(1);
  }
  else
    hb_retl(0);
}
Since if your app has some construct like:

Code: Select all

DO WHILE...

<Very long process>

ENDDO
System messages are not processed and your application enters in an 'not responding' state.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Show indexing progress

Post by cocoking »

TYVM, mrduck. TYVM Roberto.

The DO EVENTS seemed to have done the trick. The display of files went step by step (fast but noticeable) unlike before when the display seemed like a one-time painting of the editbox).

When I tried a trace debug though, the editbox did not update until when control was returned to the ACTIVATE WINDOW (as before). When I step on the DO EVENTS commands, the editbox display was unchanged.

Could it be a behavior of Debug? Or could it be by design that windows are only updated at the end of the event loop?

Please correct me if my understanding is wrong.

Thanks a lot.
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Show indexing progress

Post by Roberto Lopez »

cocoking wrote:TYVM, mrduck. TYVM Roberto.

The DO EVENTS seemed to have done the trick. The display of files went step by step (fast but noticeable) unlike before when the display seemed like a one-time painting of the editbox).

When I tried a trace debug though, the editbox did not update until when control was returned to the ACTIVATE WINDOW (as before). When I step on the DO EVENTS commands, the editbox display was unchanged.

Could it be a behavior of Debug? Or could it be by design that windows are only updated at the end of the event loop?

Please correct me if my understanding is wrong.

Thanks a lot.
I'm not sure to had understood you, but I'll try to answer...

Activate Window is a wait state, similar to Clipper's READ.

So, your application will be 'stopped' there, until the window is closed.

Your code will be executed only on events (ie control's OnGotFocus/OnLostFocus). This is similar to functions associated to when and valid events in Clipper's @...GET.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Show indexing progress

Post by cocoking »

Activate Window is a wait state, similar to Clipper's READ.

So, your application will be 'stopped' there, until the window is closed.

Your code will be executed only on events (ie control's OnGotFocus/OnLostFocus). This is similar to functions associated to when and valid events in Clipper's @...GET.
So, the DEFINEs are equivalent to the @ SAY...GETs and ACTIVATE WINDOW is like READ.
It is during ACTIVATE WINDOW that the program finds time to (1) catch up on pending processes and (2) wait for the next user action, as requested/required by the control(s).

Then when main form is released, the program ends. That means all codes after the ACTIVATE WINDOW will not be executed.

I hope I got it right.

TYVM once again to Roberto, mrduck, esgici, and rathi.
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Show indexing progress

Post by Roberto Lopez »

cocoking wrote: So, the DEFINEs are equivalent to the @ SAY...GETs and ACTIVATE WINDOW is like READ.
It is during ACTIVATE WINDOW that the program finds time to (1) catch up on pending processes and (2) wait for the next user action, as requested/required by the control(s).

Then when main form is released, the program ends. That means all codes after the ACTIVATE WINDOW will not be executed.

I hope I got it right.

TYVM once again to Roberto, mrduck, esgici, and rathi.
Yes.

Please consider that @... style definitions can also be used. Check documentation.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Show indexing progress

Post by cocoking »

Thank you, Roberto.

Speaking of documentation, has there been a documentation about the usage of the _HMG_SYSDATA array? Would you recommend using it for debugging?

Thanks,
cocoking
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Show indexing progress

Post by Roberto Lopez »

cocoking wrote:Thank you, Roberto.

Speaking of documentation, has there been a documentation about the usage of the _HMG_SYSDATA array? Would you recommend using it for debugging?

Thanks,
cocoking
_HMG_SYSDATA is an internal data array, so, the user should not touch it at all.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Show indexing progress

Post by cocoking »

I definitely have no intention to touch or modify its contents. I was just hoping I could get additional info for debugging my programs or see if it could help me understand how HMG works.

Anyway, I take it as being undocumented at this time.

TYVM, Roberto, for taking time to help. I really appreciate it.
Post Reply