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

logista logista at gmail.com
Sun Aug 12 19:21:04 UTC 2007


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)

Here's what my dialog box is asking for (takes a selection and indents
both ends):

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

    rtMargin = dialog.request_string(	:prompt   =>  "What is the
(absolute) right margin?",
	    							:button1  =>  "OK").to_i
    indentSize = dialog.request_string(	:prompt   =>  "How much left
margin indent?",
                								:button1  =>  "OK").to_i



When I tried the change on my second command I got a slightly different error:

      /tmp/temp_textmate.7qLRFt:11: uninitialized constant Dialog (NameError)

And the dialog command (takes a document and changes some numbers):

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

    myFirstPage = Dialog.request_string(	:prompt   =>  "What is the
first page number?",
								:button1  =>  "OK").to_i


Thanks for your help!
Barbara



More information about the textmate mailing list