Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Seeking advice on OnScreenDisplay
#1
Suppose that you run the code :

Code:
Copy      Help
OsdClose "osd_inm"
OsdClose "osd_sub"
OnScreenDisplay "Category" -1 10 10 "Times New Roman" 11 0x6030CF 1 "osd_inm" 0xCFEAEB 500
OnScreenDisplay "Subject" -1 10 35 "Arial" 7 0xFF0000 1 "osd_sub" 0xCFEAEB 500
5
OsdClose "osd_inm"
OsdClose "osd_sub"
OnScreenDisplay "Category-1" -1 10 10 "Times New Roman" 11 0x6030CF 1 "osd_inm" 0xCFEAEB 500
OnScreenDisplay "Innews_Subj-1" -1 10 35 "Arial" 7 0xFF0000 1 "osd_sub" 0xCFEAEB 500


Then on the 3rd OnScreenDisplay execution (Category-1) this item loops 1000 and then it aborts on :

Code:
Copy      Help
rep(1000) if(v.created) break; else 0.01 ;;wait for window created because caller may need it immediately

Any advice is mostly welcome.

Regards
#2
Should wait longer?
#3
Dear Gintaras,

Thanks for your reply. I am wondering about the question mark (?) in your reply. I would appreciate it if you could kindly clarify. It is obvious that I am using the OnScreenDisplay version supplied in QM System Folder.

Regards
Simos
#4
I think 10 s waiting is enough. Normally after 0.01 s the osd window is created. If there are such conditions that it is not created after 10 s (100% CPU, low memory), the 0.01 actually will be much longer...
#5
Dear Gintaras,

I have analysed the situation, but I still have some difficulty in formulating a smart solution. Specifically :

osd_close :

Code:
Copy      Help
int h
if(len(osdid))
    h=win(osdid "QM_OSD_Class")
    if(h) clo h; err
else
    rep
        h=win("" "QM_OSD_Class")
        if(!h) break
        clo h; err

should wait before exiting, namely after statement
Code:
Copy      Help
if(h) clo h; err


for OSD_Main to cnclude the execution of the relevant thread, before entering into a new one, indeed with the same name. Therefore, OSD_Main, right after MessageLoop, it should send a message to OSD_Main for the relevant thread :

Code:
Copy      Help
v.created=1
MessageLoop
err+ ;;out _error.line

I tried to use the method of setting events. It worked partially. My problem is that I do not know how to communicate the thread name (namely "osd_inm" and/or "osd_sub") between these two routines.


Any advice is mostly appreciated.
#6
I don't understand. Look in OsdHide function, it closes the windows differently.
#7
Many thanks, it is perfect with OsdHide. I am sorry, unfortunately I was using OsdClose since a couple of years.


Forum Jump:


Users browsing this thread: 1 Guest(s)