?
Solved

"program not responding" while using FOR...NEXT

Posted on 2003-03-25
5
Medium Priority
?
518 Views
Last Modified: 2013-12-26
Hey everybody!

I´m writing a program that controls a machine using serial communication. I have to send coördinates taken from a excel document true the serial port. This all works fine but i have to insert a STOP button. My problem is powerbuilder can´t detect wether i´m pressing the button or not.
i think this is because i am using an FOR..NEXT statement.

let me explain:
the program can be busy in the FOR..NEXT statement for about an hour...while the machine isn´t ready it keeps sending coördinates. during that time the program is only looping in ONE statement. in my statement i have used the script

if cb_stop.enabled = false
   goto stop
end if

but i can´t press the stop button because powerbuilder is too busy looping the FOR..NEXT statement..

is there any solution for this problem??

Thanks in advance

willem hagen

ps. I hope i´ve made my problem clear but it´s very hard to describe for me in english...
0
Comment
Question by:wbph
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:bluecomet
ID: 8203623
Hi wbph,

i am working also on a solution where one application uses thread and where when is needed, any object has his only process time.
So imagine that you have an thread (process) for sending cordinates and one thread where you can all times stop the script.

Refer you on this question for maybe mor explanation

http://www.experts-exchange.com/Programming/Programming_Languages/PowerBuilder/Q_20544808.html

I see for the moment only this way to use threads for you.
0
 
LVL 2

Expert Comment

by:SylvainPouliot
ID: 8204148
Did you try using the yield() function in your loop?
0
 

Author Comment

by:wbph
ID: 8204181
i have read about the yield function in the powerbuilder help...

but how do i have to use it...
I have the start and stop button in de same window(the start button is the one with the for..next statement)

thanks,

wbph
0
 
LVL 2

Accepted Solution

by:
SylvainPouliot earned 460 total points
ID: 8204229
for x = ....

  ..your_code..

  yield()
if cb_stop.enabled = false
  goto stop
end if

next


If you can't make it work, post a part of your function so I can modify it
0
 

Author Comment

by:wbph
ID: 8204369
thanks for your answer!

i didnt know the yield function but it works great!

thanks!

willem
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question