forcing to choose only two object by click

SGuzin s.guzin at gmail.com
Thu Mar 1 12:09:36 UTC 2012


Hi, I have written before the same problem but I could not get any
reply neither in pst forum (http://support.pstnet.com/forum/
Topic5781-23-1.aspx) nor in googlegroups.  I think I wrote a bit
complicated with my limited English. I am writing again i a simple
way.

I have 8 checkboxes on a slide (checkboxes are an empty square image
on the slide and named, Check1, Check2….. Check8).
Participants must choose two of them for each trial by clicking on the
checkboxes. When they click on a checkbox, it fill with black to show
as it is checked. There are two correct checkboxes out of eight for
each trial. But I want that participant must choose only two of the
checkboxes and not being allowed to choose a third one. If they click
on a third one their last selection will be disappear and replace with
third click.
How can I limit checking checkboxes to two while they could change
their selections without exceeding two limit? My code is below;

'Designate "theState" as the Default Slide State, which is the
current, ActiveState
'on the Slide object "Stimulus"
Dim theState as SlideState
Set theState = Stimulus.States("Default")

'Variable for holding the name of the sub-object clicked by the
subject.
Dim strHit As String

'Variable for holding the subject's response information.
Dim theMouseResponseData As MouseResponseData

'Was a response made?
If Stimulus.InputMasks.Responses.Count > 0 Then

	Set theMouseResponseData =
CMouseResponseData(Stimulus.InputMasks.Responses(1))

	strHit = theState.HitTest(theMouseResponseData.CursorX,
theMouseResponseData.CursorY)

	'If a check box was clicked, check or uncheck it based on its current
state.
	If Mid(strHit, 1, 5) = "Check" Then

		'Store the number of the checkbox clicked.
		Dim nCheck As Integer
		nCheck = CInt(Mid(strHit, 6, 1))
		Debug.Print nCheck

		If c.GetAttrib("Check" & nCheck & "Image") = "checkempty.bmp" Then

			c.SetAttrib "Check" & nCheck & "Image", "checkfull.bmp"

				'If a box has been checked, log the RT and RESP.

				Else

			c.SetAttrib "Check" & nCheck & "Image", "checkempty.bmp"
			c.Setattrib "Check" & nCheck & "RESP", ""


		End If
				End If

			if c.GetAttrib("Check4Image")="checkfull.bmp" and
c.GetAttrib("Check5Image")="checkfull.bmp" and
c.GetAttrib("Check1Image")="checkempty.bmp" and
c.GetAttrib("Check2Image")="checkempty.bmp" and
c.GetAttrib("Check3Image")="checkempty.bmp" and
c.GetAttrib("Check6Image")="checkempty.bmp" and
c.GetAttrib("Check7Image")="checkempty.bmp" and
c.GetAttrib("Check8Image")="checkempty.bmp" Then
		     'if strHit = "Check5" and strHit = "Check4" Then
			 	Stimulus.ACC = 1

			else Stimulus.ACC = 0
			End if
	If strHit <> "Next" Then
		Goto ChooseAgain

	End If

End If

Thank you
Güzin

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list