The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 WaitCursor

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
chintan Posted - 06/17/2015 : 08:23:09 AM
Origin Ver. 8.0
Operating System:Win 7 - 64 Bit

Hi,
How we can show WaitCursor while the programme is doing somthing in background.I found WaitCursor() in help,but its not clear for me .
After execution how we can return to normal cursor ?

Regards,
Chintan.

cmbhatt
4   L A T E S T    R E P L I E S    (Newest First)
long123 Posted - 07/07/2015 : 03:10:16 AM

As far as when to use the wait cursor when calling multiple functions- play with the code below to see an example.

sbvdxfnbghm
cdrozdowski111 Posted - 06/18/2015 : 6:40:03 PM
You cannot chose the wait cursor- it is whatever the system designates as the wait cursor.

As far as when to use the wait cursor when calling multiple functions- play with the code below to see an example. As it is now, the wait cursor will run until all the functions within the same scope have run. Try commenting out the call in myfunc() and uncommenting those in the two other functions. You'll see the effect.

Cheers,
Chris


void myfunc()
{
	waitCursor junk;

	mywork1();
	Sleep(5000);
	mywork2();
}


void mywork1()
{
	//waitCursor junk;

	Sleep(5000);
}

void mywork2()
{
	//waitCursor junk;

	Sleep(5000);
}
chintan Posted - 06/18/2015 : 03:30:51 AM
Hi Chris,
Thanks for your reply.
Is there any way to keep the cursor busy until the execution of 4,5 functions with out declaring it all the time ? Also is it possible to select the type of busy cursor ??

Regards,
Cmbhatt.

cmbhatt
cdrozdowski111 Posted - 06/17/2015 : 11:49:16 AM
cmbhatt,

Typically when you declare a waitCursor object the cursor will immediately change and then revert back to the normal cursor once the current code scope (as defined by brackets {}) is finished. For example, if you declare it at the beginning of a function, when the function returns, the cursor will automatically be restored to the normal one.

For example:


void myfunc1()
{
	// Change to busy cursor with this declaration
	waitCursor wc;
	
	// Do something time consuming

	// When function returns, the cursor returns to normal
}


However, you can leverage the fact that declaring a waitCursor is scope-dependent. In the example below, I have added a set of brackets to give the waitCursor scope. After the closing bracket, the cursor will return to normal. One caveat with doing this sort of things is that it can complicate variable scoping so you have to be really careful doing it.


void myfunc2()
{

	// Add a set of brackets to create scope for the wait cursor.
	{
		waitCursor wc;
		
		// Do something time consuming in this scope and show waitCursor
	}
	// Outside of above bracket scope, cursor returns to normal

	// Now continue doing other things and cursor will be normal pointer.
}



I hope this helps,

Cheers,
Chris

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000