Make bullet/num/check lists in UITextView - ios

I am working on text editor app and using UITextView for this. Does anybody know how to make ability to do bullet/num/check lists in it? Any examples/tutorials?
Note: I need to do this as a part of text editor, so user can select some area, tap on according button and enable/disable lists formatting.

Based on my research for similar behavior (e.g. Bullet list and Numbered list in UITextView ), I would expect that there is no easy way to do it. I expect that you will have to use textView(_:shouldChangeTextIn:replacementText:) to hack currently added text to manually add bullets/numbers - e.g., if the user set that she currently wants to use unordered list, you will have to detect a new line added in shouldChangeTextIn and manually add there the bullet and indentation.
Another approach which you might consider (its applicability depends on your requirements) is to customize existing open source rich text editor. In my case I was able to get close enough to what I needed using RichEditorView, which uses HTML+CSS as an underlying technology (so to be able to do customizations, you need to know a bit about JavaScript, CSS and HTML).

Related

implement select/cut/paste in TextArea

How can I implement the tradition menu items to copy / cut / paste / selectAll
in Codenameone TextArea
I can do these things if I happen to remember the keystrokes, but I don't
see any hooks to do them programmatically.
Since on-device editing is native the cut/copy/paste work thru touch and the menu will implicitly appear. So normally you wouldn't want to do this programmatically in Codename One, e.g. right now we don't have any API to get the currently selected text either since that concept is pretty different between platforms.
There are Display.copyToClipboard & Display.getPasteDataFromClipboard but those aren't for the text field selection purpose. They are rather for the use case of moving data within/between apps.

Supporting Drop Caps in Text Kit

I’m building an iOS reader app where I need to be able to highlight selections of text and optionally link notes with highlights. I’ve begun by using Text Kit (UITextView, NSAttributedString). I am targeting iOS 7, 8, and 9.
My problem is that I need to be able to support Drop Caps on certain paragraphs in the content. This means the first letter of a paragraph is the height of 2 lines of text and the first 2 lines of text appear beside it, then the remaining lines wrap under. My content has many drop cap characters on various paragraphs throughout.
Example showing 4-line drop cap.
Text Kit: Exclusion Paths
My initial assumption was that I would use Text Kit exclusion paths so that paragraph would wrap around it. But I can’t figure out a way to determine the exact placement of the exclusion paths and I wasn’t sure if these would float along as my content scrolls. With this approach, I would also have to manually handle text selection of the Drop Cap characters, which I’d like to avoid.
Text Kit: NSTextAttachments
I was hopeful that I could use inline Text Attachments (NSTextAttachment), but I can’t determine a way to have 2 lines wrap beside it.
Core Text
I found a couple older (pre-TextKit) examples of Drop Cap implementations using Core Text, however, every one showed only the first character of the content as a Drop Cap and not multiple paragraphs throughout the content as I need. I was hoping to avoid Core Text also since I’d rather not handle text selection manually.
https://stackoverflow.com/a/14469897
https://stackoverflow.com/a/14639864
https://stackoverflow.com/a/9272955
Current Hope/Question
NSTextAttachment feels like the simplest approach. Is there a way to wrap 2 lines of text beside it?
Fallback... I’m beginning to wonder if I should switch to WKWebView and drop iOS 7 -- since HTML supports drop caps and WKWebView provides more performance than UIWebView.

Delphi - Activating the Hint from another control of Application

I'm trying to activate Hint from control of different application created from delphi upon focus, I'm using hook to identify the focused control, and then use WM_MOUSEMOVE, which I think will activate the Hint of that control, the handle would be the Control itself and the lParam is the Left and Top of the Control. The Control activate the OnMouseMove Event, but the Hint never shows. but when I use SetCursorPos, Hint show, but I need to show the Hint with out the cursor move on that Control. Can you please help me with this? Thank you in advance... by the way I'm using Delphi XE4
Among the really asked question is how to show the hint of a control that resides on another application (i am afraid without hook that application can not be done), the title is "Delphi - Activating the Hint from another control of Application".
First is first: That can be done without knowing what language the other app was done, but it is very complex to put it here (and i am not an expert on such way of coding, also i hate apps that work that way).
Second: The main idea is to hook the other application, search on Google some code of that apps, that can show you a rectangular hole square of the object the mouse is passing over, that application while doing it is iconized (i do not remember the name of it).
Waht such app does: As you move the mouse over the screen it overlays a rectangular over the control that mouse is over, then if you press the key to print screen, that small region is the only thing that goes to clipboard; on of such apps i saw had an extra funcion, they can move such controls if you press cursors on keyboard, also can hide/enable/disable such control... more, it can also make controls that are invisible to be visible, etc... i saw it working on my computer, and hey, for fun it is pretty and to DeBug or get extra things on some apps is also great (make some menús to be visible and enabled and then can use such funtions).
Please, please, understand i am agaist piracy and also against using such apps to let code to be run... some apps need pay for letting some menus enabled, but they have the code there, no need to change EXE to have/use that menus; just using this kind of apps makes that limited apps to be unlimited (just enable or show hidden menus and voila).
Note: To unhide menus, mouse point is not needed to be over the app, can be anywhere and is not moved.
The idea i want to say is: Any app can move, alter any control on any other app (at least on Windows) that is running, so maybe there can be a way to show such hint.
In the past i had use such app (sorry i do not remember the name) for DeBug my own apps, so i do not need to recompile in such cases where something was wrongly hidden, also work with buttons, labels, texts, combos, memos, etc.
Now my small problem is: I just need exactly what title say, but i can not make it to work.
Must be:
Mouse position must be irrelevant (it also must be able to be outside the application)
Just when a button that has focus is pressed with keyboard (Space or Enter) or just after some code somewhere on my application, i want to show the Hint of a specific TEdit for a short period of time.
I did not get Hint to be shown; not unless mouse point is over such TEdit but i want/need mouse pointer to not be over it, neither it to jump to the TEdit.
Idea Conept for that Hint to be shown: After doing some code that changes something, show extra info associated.
Example:
A button with that loads a file using an open dialog, filename is put on a ReadOnly TEdit (so it let user copy the text, but not change it); i want extra info that i punt on .Hint of such TEdit to be shown inmediatly.
That hint use is for not overload window with a lot of fields (TLabels) for showing such file data.
Simple idea: such Hint shows TimeStamp and size of the selected file.
P.D.: Not much related (since i am trying with a normal plain text hint), but hints can also store a full HTML page and with 3rd party tools be shown as an HTMLhint, so they can show a lot info of that file (also its content, etc) in a web based format; as i say i first try with standard plain text hints.
In order to show hint programatically you need to call TApplications ActivateHint method to which you specify the position parameter.
http://docwiki.embarcadero.com/Libraries/XE3/en/Vcl.Forms.TApplication.ActivateHint
Based on position parameter Application automatically finds which controll is at that position and shows its hint.
NOTE: Position parameter screen coordinates in pixels and not your controll coordinates. So you will have to use ClientToScreen method to change your coordinates apropriately.
You can see simple example of how to use this here: https://stackoverflow.com/a/15031208/3636228
Now if you need to do this from another application then you will have to add some comunication mechanizm to these two application so that one could send a proper message to tell the other to show the hint at specific position. But this does require you to be able to change both applications.
EDIT: This works with VCL applications but I'm not sure if it would work with FireMonkey applications.

Custom Dock in Gimp

In GIMP: is there a way how to make my own custom dock (toolbar) where a could put my most used functions?
Something like this:
Create new empty dock or toolbar
Somehow set what functions will be in it
(any of the functions, no matter it has an icon or where in menus is located)
I'd like to have it so I don't have to search in menus every time I need something. I'm aware that I can make keyboard shortcuts but they are difficult to remember since I don't use Gimp every day. I'm used to this from Corel Photopaint and I think it is really useful.
Thanks for your suggestions.
In GIMP 2.8, you can only customize the dockable dialogs - by dragging then around, and in another level, customize tool presets and make use of the tags in the presets dialog to quckly access paint-modes with set brushes, gradients and painting dynamics - so, keeping the tool-presets dialog around, and appropriately using the tags can give you quick access to these settings.
You can't, however, add additional menu entries or icons to select particular plug-ins (filters) - and access those from any of the dockable dialogs. without rebuilding GIMP, you could edit the XML files at /usr/share/gimp/2.0/menus to customize your menus.
In the master branch, the unstable "GIMP 2.9" which will eventually become GIMP 2.10, there is a "search" action implemented, initiated by pressing the / character that will probably make it for the need to quickly find-out any operations wanted.

Delphi TListBox iOS making new itemstyle/behavior

I need to show custom data. For example I need to show a contact list with name, description, photo. And ideally I would also like to show custom data there, e.g. a button to launch telephone call. The default styles do not quite do what I want, but fairly close.
Thus, as far as I can tell, TListBox could be a decent control for this if I could create custom styles? Is that possible? (Anotther problem of course is setting the values of the custom data controls.)
You should take a good look at the FMX CustomListBox example AFAIK even the example alone already seems to have exactly what you need, already set in place.
It took me about 10 minutes to produce this result straight out of the CustomListBox example with your description:
One thing that the included FMX example demonstrates perfectly is how easy it is to add any FMX control to the ListBox via the TStyleBook Layouts such as buttons, images etc... basically any visual control upon which you then implement the HitTest, again, all very detailed in the FMX Delphi example.

Resources