Source language: Translate to:

Flashing Button Selection

General questions about NeoBook

Moderator: Neosoft Support

Flashing Button Selection

Postby martinp » Sun Mar 22, 2015 3:07 am

Not sure if this is possible within Neobooks:

To have three buttons on screen flashing on and off, in turn, repeatedly until the space bar is pressed.

Pressing the space bar will stop one of the buttons flashing and execute an action.

Basically, the person is trying to select one specific button.....if they can!

Hope this make sense!
martinp
 
Posts: 50
Joined: Fri May 20, 2005 6:18 am

Re: Flashing Button Selection

Postby Gaev » Sun Mar 22, 2015 5:29 am

martinp:

1) At the start, setup variables for ...

[Button1State] ... on/off
[Button2State] ... on/off
[Button3State] ... on/off

2) Take a look at the Timer object ... the logic for flashing the buttons goes in its TimerInterval code section ... you can provide the "flashing effect" either by alternating between HideObject and Showobject ... or by changing the parameters (e.g. font color) in SetObjectCaption ... and/or using SetObjectFill

3) in order to capture the space bar, you need to have a TextEntry object (can be off screen) that is set to receive keyboard input (via the FocusObject command) ... within the TextChange section of this object, you check if the current content is/contains a "space" ... if it does, perform the logic to "stop one of the buttons" and "execute an action"

Not sure if you want the process to stop after one selection or three ... but when you need to stop it, use the TimerStop command.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Flashing Button Selection

Postby martinp » Sun Mar 22, 2015 7:10 am

Thanks Gaev,
Will try and report back..

Need to find a way that the other boxes keeping flashing when one box has been chosen and hidden...

It's a similar process to the Catchphrase TV Game show idea...

EG:: an image is behind a load of buttons and the 'player' presses the space bar to select a button, which is then hidden to reveal part of the image behind.

Does that make sense??

Thanks
martinp
 
Posts: 50
Joined: Fri May 20, 2005 6:18 am

Re: Flashing Button Selection

Postby martinp » Sun Mar 22, 2015 10:10 am

mmm...having trouble getting it to work..

will persist

Thanks
martinp
 
Posts: 50
Joined: Fri May 20, 2005 6:18 am

Re: Flashing Button Selection

Postby Gaev » Sun Mar 22, 2015 10:37 am

martinp:

It's a similar process to the Catchphrase TV Game show idea...
Sorry, I do not know that game ... looked it up on Google ... but not very clear from the (nine) image boxes (in a 3 X 3 format).

EG:: an image is behind a load of buttons and the 'player' presses the space bar to select a button
Not sure how the pressing of the space bar would determine "which button" to "select".

But why not use Picture objects (instead of Buttons) ... and have the user click on the images directly ?

You can use its Click event to trap the selection ... and SetObjectFileName to control its image.

Need to find a way that the other boxes keeping flashing when one box has been chosen and hidden...
Define "flashing" ... do "all remaining buttons" alternate between show/hide state at the same time ? ... or some boxes hide while others show at any one moment ?

In any case, you would control their state via the use of ...

[Button1State]
[Button2State]
[Button3State]

... by setting them "ON" or "OFF" to begin with.

In the the TextChange section of the TextEntry object, for the "selected button", you would set its state to "SELECTED".

In the TimerInterval code ... you would change "ON" and "OFF" values as needed ... and hide/show the corresponding boxes based on the changed values.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Flashing Button Selection

Postby martinp » Sun Mar 22, 2015 10:55 am

Thanks Gaev,
It was an English gameshow that, i'm sure. is still running on cable/satellite over here.

If you watch the youtube link below you will gauge what i'm trying to produce BUT NOT with the same background content:

https://www.youtube.com/watch?v=GJQdEY82zs0
martinp
 
Posts: 50
Joined: Fri May 20, 2005 6:18 am

Re: Flashing Button Selection

Postby Gaev » Sun Mar 22, 2015 11:37 am

martinp:

It was an English gameshow that, i'm sure. is still running on cable/satellite over here.
I don't live in England.

If you watch the youtube link below you will gauge what i'm trying to produce BUT NOT with the same background content:
https://www.youtube.com/watch?v=GJQdEY82zs0
Much of it was a bunch of guys laughing loudly ... but what I gather from the rest is that ...

1) starting with nine boxes on top of the image

2) one of the boxes is (randomly) "flashed" for a set period of time

3) (assuming that) when contestant "makes a selection", the currently flashing box is hidden (to reveal part of the image underneath)


So, you can ...

1) Start with a list of non-hidden boxes e.g. [nonHiddenBoxes] with a value of "1,2,3,4,5,6,7,8,9"

2) use a Picture object for each of the 9 boxes ... just use SetObjectFileName to switch its appearance between "normal.jpg" and "flashing.jpg" ... and keep track of it via a variable like [currentlyFlashingBox]

2) in the TimerInterval section ...

a) turn the "currently flashing box" back to "normal"

b) use [nonHiddenBoxes] to randomly select one of them ... and set its image to "flashing.jpg" ... and update [currentlyFlashingBox]

3) use the TextEntry object to trap "user selection" ... when the "space bar" is recognized, hide the "currently flashing box" (represented by [currentlyFlashingBox]) ... and remove it from [nonHiddenBoxes] ... and randomly select the next box to be flashed
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Flashing Button Selection

Postby virger » Mon Mar 23, 2015 7:05 am

Mi propuesta, USAR GIF ANIMADOS, por ejemplo
Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5.80
ObjectType=3
Name=BtStop
X=61
Y=58
W=105
H=30
Anchor=0
Text=Press 'SPACE'
Align=2
Key=32
ImageStyle=0
BevelWidth=0
ObjAction=timerstop "TM"¶... hideobject "Gif[gif]" "" ""¶GIFStop "GIF[gif]"¶delay "2000"¶... showobject "Gif[gif]" "" ""¶GIFPlay "gif[gif]" "0"¶timerstart "TM" "200"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=9
FontStyle=1
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=19
Name=GIF0
X=20
Y=15
W=34
H=34
Anchor=0
LoopTimes=0
FileName=GifA.gif
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=MS Sans Serif
FontSize=8
FontStyle=0
FontCharset=1
TextColor=-16777208
TabOrder=5
ObjectType=15
Name=TM
X=17
Y=58
W=32
H=32
Anchor=0
Interval=200
ObjAction=Random "2" "[gif]"
ObjectType=19
Name=Gif1
X=60
Y=15
W=34
H=34
Anchor=0
LoopTimes=0
FileName=GifB.gif
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=MS Sans Serif
FontSize=8
FontStyle=0
FontCharset=1
TextColor=-16777208
TabOrder=4
ObjectType=19
Name=Gif2
X=100
Y=15
W=34
H=34
Anchor=0
LoopTimes=0
FileName=Gif2.gif
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=MS Sans Serif
FontSize=8
FontStyle=0
FontCharset=1
TextColor=-16777208
TabOrder=3


SOMOS TICOS
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 510
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Flashing Button Selection

Postby martinp » Mon Mar 23, 2015 8:28 am

Virger,
Gracias por la codificación. por favor aconsejo cómo lo uso en neobooks como olvidado cómo utilizar
martinp
 
Posts: 50
Joined: Fri May 20, 2005 6:18 am

Re: Flashing Button Selection

Postby martinp » Mon Mar 23, 2015 9:21 am

ENG:
Forgot how/where the code goes!.......been away from Neobooks for a few months.

Sorry guys
martinp
 
Posts: 50
Joined: Fri May 20, 2005 6:18 am

Re: Flashing Button Selection

Postby virger » Mon Mar 23, 2015 7:57 pm

1) Crea una nueva aplicacion
2) Copia el codigo
3) Insertalo en el area de trabajo
4) Busca tus 'gif-animados'
5) Listo

1) Create a new application
2) Copy the code
3) Insert it in the work area
4) Find your 'gif-animated'
5) Ready
[url]
https://www.youtube.com/watch?v=vbmRiYPCby4
[/url]
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 510
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 3 guests