[TxMt] My homemade bundle dialog boxes don't work anymore

James Edward Gray II james at grayproductions.net
Mon Aug 13 02:43:54 UTC 2007


On Aug 12, 2007, at 7:54 PM, logista wrote:

> On 8/12/07, James Edward Gray II <james at grayproductions.net> wrote:
>> On Aug 12, 2007, at 2:21 PM, logista wrote:
>>> On 8/12/07, James Edward Gray II <james at grayproductions.net> wrote:
>>>> On Aug 12, 2007, at 9:18 AM, logista wrote:
>>>>
>>>>> When I use a command that has this statement
>>>>>
>>>>>     require "#{ENV["TM_SUPPORT_PATH"]}/lib/dialog"
>>>>>
>>>>> I get an error:
>>>>>
>>>>>     /tmp/temp_textmate.rl42pL:3:in `require': No such file to
>>>>> load --
>>>>> /Users/barbara/Library/Application Support/TextMate/Support/lib/
>>>>> dialog
>>>>> (LoadError)
>>>>>       from /tmp/temp_textmate.rl42pL:3
>>>>>
>>>>> I'm not a programmer -- I just used the example from the TextMate
>>>>> book
>>>>> for the dialog box, and it worked until this last update to  
>>>>> Version
>>>>> 1.5.6 (1414)
>>>>>
>>>>> How can I fix this, please?
>>>>
>>>> Yes, the book is a little behind the times on this point.  Man
>>>> software changes fast!
>>>>
>>>> We've moved this library in TextMate's support libraries and it has
>>>> undergone some changes.  The first step to catching up is to switch
>>>> your require to:
>>>>
>>>>    require "#{ENV['TM_SUPPORT_PATH']}/lib/ui"
>>>>
>>>> Your code may just work with as little as that.  If it doesn't,  
>>>> show
>>>> the dialog part of the code and we will help you fix that up.
>>>>
>>>> James Edward Gray II
>>>>
>>>
>>> Ok. Now I get an error
>>>
>>>     /tmp/temp_textmate.eZSUIK:5: undefined local variable or method
>>> `dialog' for main:Object (NameError)
>>
>> Try adding this line after your require and before you build dialogs:
>>
>>    include TextMate::UI
>>
>> Does that fix it?
>
> No, I get the same errors on both.

My bad.  I should have looked a little better at how that module is  
built.  This code works for me:

#!/usr/bin/env ruby

require "#{ENV['TM_SUPPORT_PATH']}/lib/ui"

r_margin = TextMate::UI.request_string(
   :prompt   =>  "What is the (absolute) right margin?",
	:button1  =>  "OK"
).to_i
indent_size = TextMate::UI.request_string(
   :prompt   =>  "How much left margin indent?",
   :button1  =>  "OK"
).to_i

__END__

James Edward Gray II



More information about the textmate mailing list