Your Digital Media Has Never Looked So Good

 
scidude
Topic Author
Posts: 13
Joined: Thu Jan 08, 2009 1:07 pm

ClearRegion brightscript command

Mon Feb 09, 2009 10:32 am

Hi Folks,
I've been trying to use the method "ClearRegion" as it pertains to the "roTouchScreen" object through the published "ifTouchScreen" interface. No matter what syntax I seem to use, it always comes up on Debug with an "unrecognized command" pertaining to the ClearRegion command. The books leave a bit to be desired in regards to documenting the full options of some of the commands, so I'm wondering whether or not I might be missing something. I'm trying to clear out touchscreen hotspots, and redefine new ones on the fly. Can this actually be done with the repetoire of commands available to me? It all seems so logical until the unrecognized command situation. Any hints would be really appreciated.
 
RokuLyndon

Mon Feb 09, 2009 10:54 am

can you send me a code example that shows this error? What software version do you have on your unit?

Yes, you can clear regions on the fly. You should be able to do it using the mehtods you are descibing.

Lyndon
 
scidude
Topic Author
Posts: 13
Joined: Thu Jan 08, 2009 1:07 pm

Tue Feb 10, 2009 11:08 am

Hey Lyndon,
Thanks for getting back to me so soon. I've included my code, which just goes from one video to another via simple touches. One question I have on the ClearRegion command is how do you (or can you) specify a particular hotspot? If so, does one put the userid of the touchspot into the brackets at the end of the ClearRegion command? Regardless....here's my code (be gentle....I've just started with BrighScript..ha..ha):

vid=CreateObject("roVideoPlayer")
aud=CreateObject("roAudioPlayer")
vmd=CreateObject("roVideoMode")
tch=CreateObject("roTouchScreen")
v=CreateObject("roMessagePort")
a=CreateObject("roMessagePort")
t=CreateObject("roMessagePort")
vmd.SetMode("1024x768x60p")
vid.SetAudioOutput(0)
vid.MapStereoOutput(2)
vid.SetPort(v)
aud.SetPort(a)
tch.SetPort(t)
vid.SetViewMode(0)

Main:
tch.AddRectangleRegion(113,255,149,513,1)
vid.PlayFile("\Untitled.mpg")
repeatt1:
touch=wait(0,t)
touch1=touch.GetInt()
if touch1 = 1 then
vid.Stop()
'tch.ClearRegion(1)
goto cabinet
endif
goto repeatt1




cabinet:
tch.AddRectangleRegion(512,384,200,200,2)
vid.PlayFile("\filecab.mpg")
repeatt2:
touchc = wait(0,t)
touch2 = touchc.GetInt()
if touch2 = 2 then
vid.Stop()
'tch.ClearRegion(2)
goto Main
endif
goto repeatt2

Please note that the program is not perfect but I just threw it up to test the ClearRegion command. I've also included it into other programs, with the same negative results. Again, I tried the command without the final brackets, with the brackets containing no value and with brackets and userid value.....same error message. Thanks in advance for your efforts folks...the support is really appreciated.
 
RokuLyndon

Tue Feb 10, 2009 1:52 pm

I added some print statements to make it easier to debug while I was testing it out, but the problem was the ClearRegion command itself. Looks like there's a typo. It's ClearRegions(), plural.

debug=true
vid=CreateObject("roVideoPlayer")
aud=CreateObject("roAudioPlayer")
vmd=CreateObject("roVideoMode")
tch=CreateObject("roTouchScreen")
v=CreateObject("roMessagePort")
a=CreateObject("roMessagePort")
t=CreateObject("roMessagePort")
vmd.SetMode("1024x768x60p")
vid.SetAudioOutput(0)
vid.MapStereoOutput(2)
vid.SetPort(v)
aud.SetPort(a)
tch.SetPort(t)
vid.SetViewMode(0)

Main:
tch.AddRectangleRegion(113,255,149,513,1)
vid.PlayFile("\Untitled.mpg")
repeatt1:

if debug print "Waiting for touch event."
touch=wait(0,t)
if debug print "Touch event received: ";touch.GetX();" : ";touch.GetY();" : ";touch.GetInt()
touch1=touch.GetInt()
if touch1 = 1 then
vid.Stop()
tch.ClearRegions()
goto cabinet
endif
goto repeatt1




cabinet:
tch.AddRectangleRegion(512,384,200,200,2)
vid.PlayFile("\filecab.mpg")
repeatt2:

touchc = wait(0,t)
if debug print "Touch event received: ";touchc.GetX();" : ";touchc.GetY();" : ";touchc.GetInt()
touch2 = touchc.GetInt()
if touch2 = 2 then
vid.Stop()
tch.ClearRegions()
goto Main
endif
goto repeatt2
 
scidude
Topic Author
Posts: 13
Joined: Thu Jan 08, 2009 1:07 pm

Wed Feb 11, 2009 7:25 am

Ahhhhhhh.....thank you. I knew it had to be something like that. The manual has that command typo in it (not the only one, check out the command "AddRectangular_region" which should be "AddRectangular_Region"). Next time I'll try more incarnations of a command if I get a similar "unrecognized command" complaint. Heck....it's easier to just ask you folks.....your support is excellent. Thanks again guys, and now.... back to programming.

Who is online

Users browsing this forum: No registered users and 4 guests