Syntax Highlighting

Hi folks. Sorry as I have asked this question before and there have been a million threads on it but have searched the forum and can’t find the answer.

What is the best free control available for syntax highlighting. In particular I am looking for CSS highlighting but will write a definition if required. Code folding and autocomplete would be a bonus but not critical.

Check out https://code.google.com/p/custom-editfield/

To add to Frank’s brief pointer, CEF consists of two separate parts in this regard: The editor control and the code for syntax highlighting. Mike, you want to just look for the highlighting example in the Examples folder.

Thomas, thanks, Just getting my head around it now. Trying to write a def for CSS files.

Anyone that has tried using CustomEditField in a Xojo application will have discovered the horrible bugs and ThreadAccessingUI problems. I took the liberty of updating the control for Xojo 2013 r1 (still works with 2013r4.1), removing the bugs and making it “Xojo” acceptable.

Here is the newest revised version:
http://www./demos/CustomEditField.xojo_binary_project

@Mike Charlesworth, we will have to touch basis this week for the code collaboration.

matthew… just download the link above and run the project and got error about “missing file simscript plugin Designer” for 5 images

For the CustomEditField? Running a search query in Xojo on the source doesn’t return any results for “simscript”. In the SimControls which I sent you (which I believe we are meaning), you may delete the SimPlugins folder as the contents will not work without the other dependencies. In the demo I included a whole library of controls. The SimTextField will encounter the User32 error since the Mac version of Xojo seems to neglect:

  #If Not TargetWin32 Then Return Nil
  //Need this to get the "Real" Window/Object Handles
  Declare Function GetDC Lib "User32" (HWND As Integer) As Integer
 ...

If I had my mac available I’d test to be sure.

But the CustomEditField above should be fine as is.

[quote=56331:@Matthew Combatti]Anyone that has tried using CustomEditField in a Xojo application will have discovered the horrible bugs and ThreadAccessingUI problems. I took the liberty of updating the control for Xojo 2013 r1 (still works with 2013r4.1), removing the bugs and making it “Xojo” acceptable.

Here is the newest revised version:
http://www./demos/CustomEditField.xojo_binary_project [/quote]

Brilliant, thanks I will give this a try.

Good stuff, I have PM’d my email address to you, thats probably easier

matthew, i manage to get the images for CustomEditField from https://code.google.com/p/custom-editfield and got it working now.

Sorry, I know what you meant now. I only included the revised CustomEditField to replace in the code.google.com/custom-editfield project (by means of physically replacing the one in the project with the one I uploaded). I suppose I should have specified that. :slight_smile:

•Anyone that downloads the the revised update for Xojo source of the Custom-EditField from:

http://www./demos/CustomEditField.xojo_binary_project

You will need these images from the original package.
bookmarksimg
blockEndMarker
blockFoldedMarker
blockFoldedTrailMarker
blockStartMarker

those 5 images is pointing to your simscript folder

I downloaded the Xojo project and ran it on my Mac with v2014 1.1 and got this error message:

[quote]An exception of class ThreadAccessingUIException was not handled. The application must shut down.
Exception Message: A thread has attempted to manipulate a user interface element. This can only be done from the application’s main thread.[/quote]

I’d love to be able to have a Cocoa version of my app but I don’t think there’s anything available in all of Xojo-land that’s as full featured (and easy-to-use) as Restrepo’s CustomEditField. Which is a sad state of affairs.

Jay

Unfortunately that edit field needs to be updated for Cocoa since the text input systems are vastly different between Carbon & Cocoa.

We also had to rewrite the editor for the UI to make a lot of behaviors with Cocoa possible like holding down the e key & getting the popup of variants.

Why is when I click on the following link (copies from above)

[quote]
http://www./demos/CustomEditField.xojo_binary_project [/quote]

I get a new tab which displays a bunch of junk? (This has happen before.)

weird… i try the link and it download right away

The Formatted Text Control can also do syntax highlighting, I think.

[quote=92724:@Jim Smith]Why is when I click on the following link (copies from above)

I get a new tab which displays a bunch of junk? (This has happen before.)[/quote]

Hi jim, your browser is reading the xojo binary extension as a text mime-type. Mime-types tell a server/browser how to handle the specific file type (execute, display as plain text, reference a file for download are the most common). You should be able to fix this in the browser settings or view the link item menu (on windows right click the link) and choose save link/download link/or whatever variations of similar message the browser may give. If you need help fixing this issue in your Web browser I, or anyone here, or even a Google search may be able to help so the issue doesn’t keep happening to you. But the aforementioned trick should suffice as a work around in the event you desire to download content and the browser doesn’t agree.

[quote=92724:@Jim Smith]Why is when I click on the following link (copies from above)

I get a new tab which displays a bunch of junk? (This has happen before.)[/quote]
On OSX just right click the link and on the context menu select download linked file. Your browser is displaying the contents of the file rather than downloading it.

CEF has been converted for Cocoa months ago. I wonder what old code people keep finding.

The official version is currently here: https://code.google.com/p/custom-editfield/
Though, sadly, you’ll need a svn client to download it.