There is a new version at: http://haridara.googlepages.com/forms.vim
Significant changes being: - Support for disabling fields. - Validator support. - Cursor monitoring to prevent accidental editing of readonly parts of the form. - Several bug fixes. - <F2> to start edit mode. - Implemented several TODO items. - Added some new TODO items :) Combobox functionality is now less flaky, but I have some ideas to make it better, especially with the readonly version. I have put in several guards to make sure editing can be done only in the areas where it is supposed to be done. Please feel free to break this and let me know so that I can plug any more holes. I modified the demo to include both enabling/disabling fields as well as validation (zip field). The demo could be something useful, e.g., a find dialog like in MS Word, but that could be a lot of work and I would rather spend that time in improving the script. See below for my comments. On Thu, 5 Oct 2006 at 1:19pm, Mikolaj Machowski wrote: > <C-N>, <C-P>? It should work everywhere and is quite natural for Vim > users (IMO). Now <C-N> and <C-P> also work like <Tab> and <S-Tab>. > I would expect some simplifying in use. For example why explicitly > declare them? Create listeners automatically. I am not still clear. How can you create listeners automatically? Can you give some example? > Check example I send earlier. Core stuff is quite simple, big part of it > is overhead dealing with listeners. Part of it is due to the workarounds you had to put in (which is no longer needed, I fixed the problem) and the rest is expected if you want any dynamic nature. If you want to simplify, all that you need is one listener for the OK button and you are done. In any case, I have added checks to make callbacks only when the dict function is defined (with no errors), so there is more flexibility. You can have all the three callbacks in one dict and use the same dict for all fields, or split them into different dicts. > > - Validators. > > Local validation (onBlur event) can be already done. Problem is when > doing after pressing OK. Hmm, in fact it can be also done but is boring > ;) to do. Some API for that would be good. How was onBlur event possible? Previously you could do validation in the valueChanged() callback, but you couldn't constrain the focus, but the new isValid() callback allows that. > > - When the focus is moved in, explicitly set the value again, to make > > sure any fouled up entries are fixed. > > Don't understand that. Maybe you were thinking about "moving out" of > field (onBlur JavaScript event)? It is already possible. I was just referring to accidentally removing too much (e.g., the {} bounds of a combobox). Now I am reasonably confident that this is not possible, so I removed this TODO item. > > - Recognize no/empty title. > > Title may be declared. Make it support for non showing it, like:: > > let demoform = g:forms#form.new('Address Entry Form', 1) > > To show it and 0 for non showing it. What is the use of declaring it when not showing? Are you thinking of it as an identifier, like a name for fields? > One change which would be good to introduce before official beta: > obligatory fields. As I wrote earlier - full validation if possible but > laborious. And declaring it in API should allow for some emphasis > (highlighting?). Does the new isValid() callback meet your expectations? -- Thanks, Hari __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com