We hold page tags in our SGML data. I'd like to display the value of the "number" attribute of the current page element on the Adept Editor status bar, and have it continually updated, in the same way that the element hierarchy is displayed. This way, the user can see at a glance which page they're looking at, without having to do a search for the previous page element. Is this possible using ACL?
I can see how this calls a function on each shift in caret position, but what I really need is that function - to locate the value of an attribute and put it to the status bar (or a separate window, I don't mind which).
If there isn't a simple solution to this, don't worry - it was just a nice-to-have feature that our editors would find useful.
will display the attribute value at the lower left status line of the pane (of course, you have to initialize the variable $attribute_value to it; for that you'd probably want to use oid_attr(oid_caret(), attr_name) ) or some variation thereof -- more info available through "help oid") . If the window is too narrow to accomodate the value, it will display a dismissable message window.
You _can_ freely use the caretMovedCallback, it's a normal, documented feature since Adept 5.4 (but not listed in the callback list, You must use the window_set function to use it), but it's not adviced: You can substitute it with a simple timer function (see timer_add_callback for details) which makes Your program be much faster. E.g. if You update the statusbar once per 5 second, it's enough for most users but has no chance to overwhelm the CPU. (ACL it not too slow for an interpreter but placing a longer function for each cursor movement will surely slow the system.)