Hi Louis,

I see... Thanks for the good explanation and sample code.

> the user answer before he gets to the main.
Umm... Okay, let me try one more time. ;-)

Is it necessary to open two windows at once?
If not, how about the following?

class Sample < Shoes
  $a = 'nothing'

  url '/', :index
  url '/main', :main

  def index
    para "What would you like?"
    button('yes'){$a = "YES"; clear; main}
    button('no'){$a = "NO"; clear; main}
  end

  def main
    button("what?") {alert("You choosed #{$a}")}
  end
end

Shoes.app :width => 200, :height => 120

Hope I've not misunderstood, :-P
ashbb


On Sun, Nov 2, 2008 at 1:55 AM, Louis-Philippe <[EMAIL PROTECTED]> wrote:

> Hi ashbb,
> this is cool but but doesn't really get me to what I am trying to do...
>
> what I am trying to do to automatically present my user with a yes/no setup
> question popping up over the the main application window at startup.  All
> the logic is already designed and working.  I just need to make sure the
> popup appear over the main window so that the user answer before he gets to
> the main.  confirm() seemed perfect because it ALWAYS gets on top, its only
> my question would really need to be twisted for it to make sense with
> ok/cancel choice, not very elegant.  Since confirm() is nor an option, I am
> trying to have it working with dialog(), but its kinda random if the
> dialog() window appears over the main window, and I didn't find any info
> about window ordering in the documentation.
>
> a sample of code which illustrate this would be:
>
> Shoes.app do
>   $a = 'nothing'
>   stack do
>     para "MUST BE UNDER - THIS IS MAIN WINDOW"
>     button("what?") { alert("You choosed #{$a}")}
>   end
>
>   dialog do
>     stack do
>       para "MUST BE OVER - THIS IS DIALOG WINDOW"
>       para "What would you like?"
>       button('YES') do
>         $a = "YES"
>         close()
>       end
>       button('NO') do
>         $a = "NO"
>         close()
>       end
>     end
>   end
> end
>
> 2008/10/31 Satoshi Asakawa <[EMAIL PROTECTED]>
>
> Hi Louis,
>>
>> We don't have any option of confirm method now.
>> But how about the following code?
>> Is this what you want to do?
>>
>>
>> Shoes.app do
>>   def button_with_confirm
>>     txt = confirm('ok or cancel?') ? 'OK' : 'cancel'
>>     @b.remove
>>     @b = append{ button(txt){button_with_confirm}}
>>   end
>>
>>   @b = button 'confirm' do
>>     button_with_confirm
>>   end
>> end
>>
>>
>> I might have misunderstood, though... :-P
>>
>> Hope it helps,
>> ashbb
>>
>>
>>
>>
>> On Sat, Nov 1, 2008 at 1:07 AM, Louis-Philippe <[EMAIL PROTECTED]>wrote:
>>
>>> oh, and do you know if there is a way to order the appearance of  app
>>> windows, I liked the confirm() because it always come on top... in my tests
>>> windows ordering was unpredictable.
>>>
>>> L-P
>>>
>>> 2008/10/31 Louis-Philippe <[EMAIL PROTECTED]>
>>>
>>>> thanks François,
>>>> I'll craft something from a dialog() then.
>>>>
>>>> L-P
>>>>
>>>> 2008/10/31 François Vaux <[EMAIL PROTECTED]>
>>>>
>>>> 2008/10/31 Louis-Philippe <[EMAIL PROTECTED]>:
>>>>> > Hi all,
>>>>> > First post on this list :D
>>>>>
>>>>> Hi, and welcome ! :-)
>>>>>
>>>>> > I have been playing with Shoes a bit, now using it to build a
>>>>> frontend for a
>>>>> > small backup script
>>>>> >
>>>>> > I have a very small question to start with:
>>>>> > Is there any option to change the text on the "OK" and "Cancel"
>>>>> button
>>>>> > inside of a confirm() dialog?
>>>>>
>>>>> I think there's no way to do that as of now, maybe _why is planning on
>>>>> adding it in the future
>>>>>
>>>>
>>>>
>>>
>>
>

Reply via email to