Coloured text in AbtMultiLineEditView

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Coloured text in AbtMultiLineEditView

Long Haired David
Hi Everyone.

I am soon to start an Open University course towards finishing my degree (I know, at 70 I should have done this many years ago but coding Smalltalk got in the way - grin).

As part of that course, I have to be able to code in Python. I find coding is a stream via a text file almost impossible to contemplate now so I am building a browser for Python using 8.6.1.

It is going very well and currently looks like this~:



The bottom area is where all of the text is entered. What I would like is for the text to be colour coded. As an example, I have pasted a small Python program into a standard VAST text window and it looks like this:


Can anyone explain how I can get the standard AbtMultiLineEditView  which I have used to look and act like the box above?


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: Coloured text in AbtMultiLineEditView

Seth Berman
Hello,

Sounds like an interesting project.  

The AbtMultiLineEditView uses a CwText.  On windows, this is the native text control (the one from notepad.exe).
The development environment tooling uses a CwScintillaEditor control which, as the name implies, uses the edit control provided by scintilla (this is what SciLexer.dll is in the Vast installation directory).
So if you ever used something like Dolphin smalltalk or Notepad++...its the same editor.

In the VA Assist development environment, there is an additional layer on top of Scintilla (StsCodeAssistScintillaSupport) which adapts Scintilla to the code assist framework...and then extends the features available since it provides the capability to do so.  One of these features is providing additional language support which is in 8.6.2 that just got released.  All this language support could be implemented by folks just using the raw CwScintillaEditor...but it's a huge API and takes a long time to get comfortable with.  Therefore, there was a VA Assist framework developed to do this (StsCodeAssistScintillaLanguages).  

If your interested, I have attached a python language extension application which shows how easy it is to add additional language support to the editor.  It took me about 5 minutes and most of that time was looking up the python keywords:)
Note: You will need 8.6.2 to run this example...the framework was not there in 8.6.1.
1. Import and load the application
2. Open up a workspace
3. In the new Languages menu on the toolbar...select python...then paste some python code in there.  Or you can open a file with a .py or .pyw extension and it will automatically select python

It is probably possible to switch out the CwText with a CwScintillaEditor in the AbtMultiLineEditView...but then we need to recreate what the VA Assist language framework does to get the syntax highlighting and whatever else you want in the editor.

- Seth

On Tuesday, December 1, 2015 at 9:48:20 AM UTC-5, Totally Objects wrote:
Hi Everyone.

I am soon to start an Open University course towards finishing my degree (I know, at 70 I should have done this many years ago but coding Smalltalk got in the way - grin).

As part of that course, I have to be able to code in Python. I find coding is a stream via a text file almost impossible to contemplate now so I am building a browser for Python using 8.6.1.

It is going very well and currently looks like this~:

<a href="https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png&#39;;return true;">



The bottom area is where all of the text is entered. What I would like is for the text to be colour coded. As an example, I have pasted a small Python program into a standard VAST text window and it looks like this:

<a href="https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png&#39;;return true;">


Can anyone explain how I can get the standard AbtMultiLineEditView  which I have used to look and act like the box above?


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.

StsPythonSupport862.dat (175K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Coloured text in AbtMultiLineEditView

Long Haired David
In reply to this post by Long Haired David
I will have a look. Thanks.

David

On Tuesday, December 1, 2015 at 2:48:20 PM UTC, Totally Objects wrote:
Hi Everyone.

I am soon to start an Open University course towards finishing my degree (I know, at 70 I should have done this many years ago but coding Smalltalk got in the way - grin).

As part of that course, I have to be able to code in Python. I find coding is a stream via a text file almost impossible to contemplate now so I am building a browser for Python using 8.6.1.

It is going very well and currently looks like this~:

<a href="https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png&#39;;return true;">



The bottom area is where all of the text is entered. What I would like is for the text to be colour coded. As an example, I have pasted a small Python program into a standard VAST text window and it looks like this:

<a href="https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png&#39;;return true;">


Can anyone explain how I can get the standard AbtMultiLineEditView  which I have used to look and act like the box above?


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: Coloured text in AbtMultiLineEditView

Long Haired David
OK, a couple of things.

1. I can't get it to load. I get the following message:
"Error: 366   Cannot complete the load because StsScintillaPythonProvider from StsCodeAssistPython 1.0 subclasses StsScintillaLanguageProvider but a definition is not specified for it."

2. As this is only for my personal use, I am probably never going to make an executable of it. As I will be working in the development image, is there some way that I can get that frame into my window? I have many years experience in VAST but all at the complex client requirement level - not at the "mess about with Abt widgets" level. Any help would be great.

David

On Tuesday, December 1, 2015 at 7:08:03 PM UTC, Totally Objects wrote:
I will have a look. Thanks.

David

On Tuesday, December 1, 2015 at 2:48:20 PM UTC, Totally Objects wrote:
Hi Everyone.

I am soon to start an Open University course towards finishing my degree (I know, at 70 I should have done this many years ago but coding Smalltalk got in the way - grin).

As part of that course, I have to be able to code in Python. I find coding is a stream via a text file almost impossible to contemplate now so I am building a browser for Python using 8.6.1.

It is going very well and currently looks like this~:

<a href="https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png&#39;;return true;">



The bottom area is where all of the text is entered. What I would like is for the text to be colour coded. As an example, I have pasted a small Python program into a standard VAST text window and it looks like this:

<a href="https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png&#39;;return true;">


Can anyone explain how I can get the standard AbtMultiLineEditView  which I have used to look and act like the box above?


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: Coloured text in AbtMultiLineEditView

Seth Berman
Hello Dave,

1. That sounds like your either not running an environment with VA Assist loaded or your not running an 8.6.2 image.
If you are running an ibmst image...make sure you load the VA Assist feature.  It should already be available in an abt image.
I forgot to mention...once you load the StsCodeAssistPython application....you will need to reload the application named StsCodeAssistApp...this will ensure the python functionality is injected into the code assist framework.  You will know it worked if you open a workspace and see Python listed in the Languages menu in the workspace toolbar.

2. There certainly is a way to get the VA Assist editor into your frame, but the tweaks required to get it married to the code assist framework would be too difficult for me to describe here.  You can always subclass something like the StsWorkspace as a starting point, and customize from there..

-- Seth

On Wednesday, December 2, 2015 at 7:17:14 AM UTC-5, Totally Objects wrote:
OK, a couple of things.

1. I can't get it to load. I get the following message:
"Error: 366   Cannot complete the load because StsScintillaPythonProvider from StsCodeAssistPython 1.0 subclasses StsScintillaLanguageProvider but a definition is not specified for it."

2. As this is only for my personal use, I am probably never going to make an executable of it. As I will be working in the development image, is there some way that I can get that frame into my window? I have many years experience in VAST but all at the complex client requirement level - not at the "mess about with Abt widgets" level. Any help would be great.

David

On Tuesday, December 1, 2015 at 7:08:03 PM UTC, Totally Objects wrote:
I will have a look. Thanks.

David

On Tuesday, December 1, 2015 at 2:48:20 PM UTC, Totally Objects wrote:
Hi Everyone.

I am soon to start an Open University course towards finishing my degree (I know, at 70 I should have done this many years ago but coding Smalltalk got in the way - grin).

As part of that course, I have to be able to code in Python. I find coding is a stream via a text file almost impossible to contemplate now so I am building a browser for Python using 8.6.1.

It is going very well and currently looks like this~:

<a href="https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-XfFZMVNAifc/Vl2ya6RpOTI/AAAAAAAAACo/LnBkYZSn4Ag/s1600/PYTHON.png&#39;;return true;">



The bottom area is where all of the text is entered. What I would like is for the text to be colour coded. As an example, I have pasted a small Python program into a standard VAST text window and it looks like this:

<a href="https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-KHgnF1VjJBI/Vl2yuEf9DxI/AAAAAAAAAC0/MiqQE-HHyDs/s1600/TEXT.png&#39;;return true;">


Can anyone explain how I can get the standard AbtMultiLineEditView  which I have used to look and act like the box above?


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.