Several people asked for this, so let us add a search feature to our example project. Beside of using
ScintillaControlMBS control to show HTML, MySQL or Xojo code, the example now includes a find and replace window:
In Scintilla you not just have a current selection (actually multiple), but also a target range. The target range is used to search and replace text without the user seeing this. We also have a FindText() function to perform a search and return the range where text is found. So you can search and show it in user interface.
Search can be done with various flags:
kFindOptionNone | Default setting is case-insensitive literal match. |
kFindOptionMatchCase | A match only occurs with text that matches the case of the search string. |
kFindOptionWholeWord | A match only occurs if the characters before and after are not word characters as defined by WordChars property. |
kFindOptionWordStart | A match only occurs if the character before is not a word character as defined by WordChars property. |
kFindOptionRegExp | The search string should be interpreted as a regular expression. Uses Scintilla's base implementation unless combined with kFindOptionCxx11RegEx to use C++11 version. |
When Regular expressions are enabled, you can use the familiar syntax and use \0, \1, \2 and so on in replacement to reference the Nth captured value.
Please try this in the next pre-release.
Let's organize some local Xojo developer meetings for Quebec City and Montreal:
If you live in this part of Canada, or you like to come over from the USA, please join those surveys to find the perfect date between 21st to 26th March 2022:
Xojo Survey for Montreal Xojo Survey for Quebec
If you like to join, please add yourself to the survey and contact us soon to put you on the list.
I reserve a table in a nice restaurant and I will be there. You can join and we can shop talk all night. Ask me plugin questions, bring your laptop and show projects.
And of course we discuss latest changes in Xojo, upcoming conferences and what's new in plugins.
Of course it is possible to arrange private meetings for consulting or training while I am in the city.
Last week the new books arrived from
XDevMag. Always great to have all the articles from one year of the Xojo Developer Magazine in one book, where you can just browse through when you have some time in your hammock.
We'll give away a few over the year at various Xojo meetings, once they start to take place again.
If you like to get one yourself, you can order them in the
XDevMag book store. When you consider ordering them, better pick several years and let them ship together at a package price. There are also academic and subscriber discounts available and shipping from USA or Europe is available.
(more)
Some clients on macOS use Documents in the Cloud with their iCloud account. Files are synchronized with Apple's server and that may take a while, so you can check how many files in a directory are uploading currently:
Shared Function CountUploadFiles(dir as FolderItem) As integer
Dim count As Integer
For Each file As FolderItem In dir.Children(False)
Dim url As New NSURLMBS(file)
If url.UbiquitousItemIsUploading Then
count = count + 1
End If
If count > 100 Then
Exit
End If
Next
Return count
End Function
For two applications we now check that and if a lot of files are uploading, we slow down creating files, so the sync process can catch up.
(more)
Our
ScintillaControlMBS can be configured to over 100 different lexers to colorize various texts. And today we configure the control for HTML:
Our plugin example comes with a file called LexerConstants.txt with all the constants. For the hypertext lexer we copy the SCE_H_* constants. Since HTML can have embedded JavaScript, VBScript, PHP and Python, we can also copy the following constants until SCE_HPHP_OPERATOR. For each of those styles you can define later an effective style with a specific color. Then we get the list of keywords for html and I just copied it from the
html.properties file used for scite. There we can also see what styles the editor uses.
With PropertyNames method in our control you can learn the properties defined by the lexer and for folding html, we turn on the fold, fold.html and fold.hypertext.comment properties. You can do this dynamically if you like. For example query PropertyNames, build checkboxes for them and use DescribeProperty() to get a descriptive text for each property.
The example project will be included with 21.1pr2 in the next days and should be a good start for anyone looking into a good HTML text editor within Xojo. Below a screenshot from Windows as this project can run on macOS, Windows and Linux.
The list of lexers available for Scintilla in our plugin is:
a68k, abaqus, ada, apdl, as, asm, asn1, asy, au3, ave, avs, baan, bash, batch, bib, blitzbasic, bullant, caml, cil, clarion, clarionnocase, cmake, COBOL, coffeescript, conf, cpp, cppnocase, csound, css, d, dataflex, diff, DMAP, DMIS, ecl, edifact, eiffel, eiffelkw, erlang, errorlist, escript, f77, flagship, forth, fortran, freebasic, fsharp, gap, gui4cli, haskell, hollywood, hypertext, ihex, indent, inno, json, julia, kix, kvirc, latex, lisp, literatehaskell, lot, lout, lua, magiksf, makefile, markdown, matlab, maxima, metapost, mmixal, modula, mssql, mysql, nim, nimrod, nncrontab, nsis, null, octave, opal, oscript, pascal, powerbasic, perl, phpscript, PL/M, po, pov, powerpro, powershell, abl, props, ps, purebasic, python, r, raku, rebol, registry, ruby, rust, sas, scriptol, smalltalk, SML, sorcins, specman, spice, sql, srec, stata, fcST, TACL, tads3, TAL, tcl, tcmd, tehex, tex, txt2tags, vb, vbscript, verilog, vhdl, visualprolog, x12, xml, yaml, xojo.
In this article I want to introduce you the new functionalities from the MBS Xojo Plugins in version 22.0.
Scintilla
With the new part Scintilla you get a text code editor at your fingertips.
With the DesktopScintillaControlMBS control and the ScintillaControlMBS control you can integrate the text editor into your solutions.
You can not only write simple texts but also mark special keywords.
Scintilla provides lexers for well-known programming and markup languages, which you can load as needed.
It provides lexers for syntax highlighting in over 100 languages including SQL, JavaScript and HTML.
We added a Xojo lexer to highlight code for XojoScript.
You can also specify your own keywords that will be highlighted in your texts.
Scintilla supports not only the highlighting of words but also features that other script editors have,
such as setting breakpoints or showing and hiding parts of the script for better clarity.
The Advanced Script Editor in your application. Test it out!
(more)
We added Phidget classes around 2010 to our MBS Xojo Plugins. We kept that running and various clients used all the old classes for various projects. To keep compatibility we renamed the old classes with a prefix Old, e.g. OldPhidgetMBS.
To support the new Phidget Library with support for Apple Silicon, we created new classes with the modern API. We can put in all the knowledge we got about C++ and Xojo and improve the classes to current standards. We wrap the C API from Phidgets library and so you can always look on their documentation, too.
Our plugin does all memory management automatically for you with allocation of required buffers. We dispatch all events on main thread including the asynchronously APIs and their completion events. You can of course use AddHandler if needed and send events to your delegate methods. We check error codes and raise PhidgetErrorExceptionMBS whenever needed. The exception then has an error message and the error code.
(more)