GithubHelp home page GithubHelp logo

popovertokenfield's Introduction

PopoverTokenField

Subclass of NSTokenField that achieves two main goal. First it presents the list of suggestions in a NSPopover filled with suggestion tokens. Second it enables the possibility of showing the suggestion when the control becomes first responder. It is useful when the list of suggestions is always limited and the developer wants to provide the user with possible tokens just before editing.

This is how it looks:

JSTokenCloud

How to use it

The class can be used directly as an alternative for NSTokenField. The subclass hijack the -(NSArray *)tokenField:(NSTokenField *)tokenField completionsForSubstring:(NSString *)substring indexOfToken:(NSInteger)tokenIndex indexOfSelectedItem:(NSInteger *)selectedIndex delegate method but forward every other delegate method as usual.

It also add the -(NSArray *)tokenField:(JSTokenField *)tokenField tokensGivenCurrentTokens:(NSArray *)tokens; delegate method to provide the control with a list of possible tokens to display in the suggestion list in the popover.

Current Limitations

  • The code has essentially no comments in it. Hopefully I will write them in the next or so.
  • There is currently no way to browse the token suggestions with the keyboard the same way it is possible to browse the suggestion menu of a NSTokenField.
  • Various bugs with forwarding delegate methods.

Credits

The code include parts from from M3TokenController (http://www.mcubedsw.com/dev) Copyright (c) 2006-2009 M Cubed Software

Copyright

Copyright (c) 2012 Jacopo Sabbatini All rights reserved.

popovertokenfield's People

Contributors

dedalusj avatar

Stargazers

 avatar  avatar Marcin avatar Chuck Kelly avatar Konstantin Pavlikhin avatar  avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.