Custom swing JDialog box not blocking...

Asked by eliteSKL

RaiMan,

I have created a JDialog box that gets called in the middle of my script. The problem is that the JDialog box doesn't block. How do i fix this?

it's like the JDialog is on it's own non-blocking thread... so the automation continues and as a result crashes.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
eliteSKL
Solved:
Last query:
Last reply:
Revision history for this message
eliteSKL (camaro70s) said :
#1

never mind i added a parameter to the custom dialog allowing me to pass in a lockObject. then i added a call to release the thread as part of the event handlers in the buttons. this worked fine for me. below

import thread,time

threadLockObject=thread.allocate_lock()
print 'Main Process'
cus=customJDialog() # create instance
thread.start_new_thread(cus.runCustomJDialog,(threadLockObject,)) # call the dialog box
threadLockObject.acquire()
while threadLockObject.locked()==True:
    print 'Thread is still waiting for response.'
    time.sleep(1)#not really needed
print (scw.PageSize,scw.PageType)
print 'Main Process'