Bring QuestionDialog to front

Hi everybody, 
I wrote this experiment in which I have a black window and show some stimuli.

Then, I call a dialog box with inputdlg to collect some info from the participant. Once the info are entered, I need to continue with the experiment to show some more stimuli.


The problem is that the box is obviously hidden on the back of the experimental screen. The participants cannot see it or type info inside.


Is there a way to bring the dialog box on front?

Thank you in advance for your time and for any advice.

Best,
Gluce

Probably the easiest thing to do would be to show the dialog box and collect the info before you ever open the PTB window, or close and re-open the PTB window if you need to use a dialog box in the middle of an experiment.

I wouldn't expect there to be a way to get MATLAB GUI windows to go in front of PTB windows; not an expert here or anything but a PTB window is generally going to want exclusive control of the screen.

- Will

On 10/17/2017 12:44 PM, gluke.f@... [PSYCHTOOLBOX] wrote:

Hi everybody,
I wrote this experiment in which I have a black window and show some stimuli.

Then, I call a dialog box with inputdlg to collect some info from the participant. Once the info are entered, I need to continue with the experiment to show some more stimuli.


The problem is that the box is obviously hidden on the back of the experimental screen. The participants cannot see it or type info inside.


Is there a way to bring the dialog box on front?

Thank you in advance for your time and for any advice.

Best,
Gluce


I see. That's in fact what I do usually. If I have to collect info such as name, age etc, I do it at the beginning. 

But this time is a special case. I need to do it during the experiment and several times. 
I could close the PTB window, call the dialog box and then re-open the window. 
I have already tried and it works. But it is not an optimal solution.

Thank you for your reply anyway =)
Indeed, do what Will says. You can't pop up the dialogue window without relinquishing timing control.

Best,
Dee

On Tue, Oct 17, 2017 at 7:05 PM, Will Hopper whopper@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:


Probably the easiest thing to do would be to show the dialog box and collect the info before you ever open the PTB window, or close and re-open the PTB window if you need to use a dialog box in the middle of an experiment.

I wouldn't expect there to be a way to get MATLAB GUI windows to go in front of PTB windows; not an expert here or anything but a PTB window is generally going to want exclusive control of the screen.

- Will

On 10/17/2017 12:44 PM, gluke.f@... [PSYCHTOOLBOX] wrote:

Hi everybody,
I wrote this experiment in which I have a black window and show some stimuli.

Then, I call a dialog box with inputdlg to collect some info from the participant. Once the info are entered, I need to continue with the experiment to show some more stimuli.


The problem is that the box is obviously hidden on the back of the experimental screen. The participants cannot see it or type info inside.


Is there a way to bring the dialog box on front?

Thank you in advance for your time and for any advice.

Best,
Gluce





Yes, I think you are right.

In the meanwhile, I thought that I should just ask the questions on the PTB screen.

The experiment is comprised of 4 short experimental sessions. After each session, the participants just have to answer some questions. 

To do that, I am now trying a function that I found: http://docs.psychtoolbox.org/Ask

But I am having troubles with this one as well. 


 These are the lines that I am using:     

    reply=Ask(my_window,  'How much rapport do you feel with your partner?', white,[],'GetChar',RectLeft,RectTop);

    reply=str2double(reply);

    Ask(my_window,'My Question PlaceHolder', white,black,'GetChar',RectLeft,RectTop);
  
The function kind of works: it shows the question on the top left of the screen. If I type, I see the numbers appear on the screen and it puts the value into the var called reply.

There are some problems:

1) The function should go on by pressing enter. If I do press enter, it shows a white screen. I have to press enter 3 times, then it goes to the second 'ask', and creates a black screen. From there I have to click enter again, and the script goes on. Isn't there a way to just click enter and go on with the script? 

2)  I tried to use reply=eval('GetChar'), as it is suggested in the psychtoolbox page, but it is not working. I tried  reply=eval(reply); and it seems to work better. Finally, I settled for what I posted above (str2double).


Finally, I have several questions. So, rather than writing them inside the function, I have created a variable with all the questions that I have to ask in different cells. Then, I wrote:

  reply=Ask(my_window,  questionsShuffled(questCounter), white,[],'GetChar',RectLeft,RectTop);

If I just type questionsShuffled(questCounter) inside the command window, it does access the text. But, if I use it in the function 'Ask', it says: 

Error using Screen
Usage:

[normBoundsRect, offsetBoundsRect, textHeight, xAdvance] = Screen('TextBounds', windowPtr, text [,x] [,y] [,yPositionIsBaseline]
[,swapTextDirection]);

Error in Ask (line 71)
    tbx = Screen('TextBounds', window, message);

Error in exp10 (line 242)
    reply=Ask(my_window,  questionsShuffled(questCounter), white,[],'GetChar',RectLeft,RectTop);

Any idea? 

Thank you again.