hpwPlusMemo

Questions about NeoBook PlugIns

Moderator: Neosoft Support

User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Re: hpwPlusMemo

Post by HPW »

Hello,
Comment char is set in the ini:
[Settings]
commentchar=!
Hans-Peter
mishem
Posts: 581
Joined: Mon Oct 08, 2012 1:51 pm

Re: hpwPlusMemo

Post by mishem »

Hello!
It is mostly difficult to guess what you want.
I want to make a program that the user can create a regular expression to plug hpwControl.
That he could see visually what he does.

hpwExecRegExpList searches for matches and displays an error if any.
hpwPlusMemo shows (highlights) matches found.
While I did not get to synchronize these two plugins.

Something like this ...

..............Rus..................
Я хочу сделать программу чтобы пользователь мог составить регулярное выражение для плагина hpwControl.
Чтобы он визуально мог видеть что делает.

hpwExecRegExpList ищет совпадения и отображает ошибки если такие есть.
hpwPlusMemo показывает (подсвечивает) найденные совпадения.
Пока у меня не получается синхронизировать эти два плагина.

Как то так...
mishem
Posts: 581
Joined: Mon Oct 08, 2012 1:51 pm

Re: hpwPlusMemo

Post by mishem »

Made an example of what I want.

Download.

It is necessary that the editor has been allocated the same as indicated in the matches found:...
Line RegEx: sends the string configuration

Code: Select all

SetVar "[TextForRegex]" "[#91]RegExKeywords[#93][#13][#10][Regex_Text]=1,0,1,0,-1,16711680,0,0,"
hpwPlusMemoLoadCfg "TextForRegex" "[TextForRegex]"
If you click on the button << >>, it will be allocated matches found hpwExecRegExpPos.
It is necessary to found and hpwExecRegExpPos hpwExecRegExpList coincided with dedicated editor.

Something like that.


///////////////////////
Comment char is set in the ini:
I load variable, not a file. I do not have these sections. Loading only

Code: Select all

SetVar "[TextForRegex]" "[#91]RegExKeywords[#93][#13][#10][Regex_Text]=1,0,1,0,-1,16711680,0,0,"
hpwPlusMemoLoadCfg "TextForRegex" "[TextForRegex]"
Still, all that is of the semicolon; until the end of the line in a different color. See. Screenshot above.
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Re: hpwPlusMemo

Post by HPW »

Hello,

First i have to check if loading from variable is supported in hpwPlusMemoLoadCfg.
The wizard says that the variable should contain a file-name.

So here migth be the problem.

Regards
Hans-Peter
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Re: hpwPlusMemo

Post by HPW »

Hello,

All settings have a default value on which it fallbacks when nothing given.
So why not add the commentchar to your ini-stream:

Code: Select all

SetVar "[TextForRegex]" "[#91]RegExKeywords[#93][#13][#10][Regex_Text]=1,0,1,0,-1,16711680,0,0,[#13][#10][#91]Settings[#93][#13][#10]commentchar=!"
hpwPlusMemoLoadCfg "TextForRegex" "[TextForRegex]"
As long you produce a valid ini-stream it is the same as loading from file.

Regards
Hans-Peter
mishem
Posts: 581
Joined: Mon Oct 08, 2012 1:51 pm

Re: hpwPlusMemo

Post by mishem »

First i have to check if loading from variable is supported in hpwPlusMemoLoadCfg.
Supported. I posted above example. Download and see. There's only the main code.
So why not add the commentchar to your ini-stream:
I've tried. If the symbol is there, there are several problems. It is certainly possible to get around and check the existence of a symbol in the text, and to substitute the one which is not.

Thank you for your answers and for plug-ins. I am still experimenting.
User avatar
stu
Posts: 322
Joined: Wed Aug 07, 2013 11:37 am

Re: hpwPlusMemo

Post by stu »

I would like to store code snippets on a small database for my personal use and I was thinking of syntax highlighting to make it more shiny... Is there a TSQL or SQL file for syntax highlighting?
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Re: hpwPlusMemo

Post by HPW »

Is there a TSQL or SQL file for syntax highlighting?
Not ready made.
But you may have a look at the example config files.
When you have a keyword list of your languages it should be simple to create your own config file.
And you can use the contained KeyWordEdit.exe to build config files with a GUI-tool.

Regards
Hans-Peter
User avatar
stu
Posts: 322
Joined: Wed Aug 07, 2013 11:37 am

Re: hpwPlusMemo

Post by stu »

Ok, thats cool... I started my SQL ini file and I have the problem of highlighting things like:

SELECT * FROM tblTest WHERE (field_one = 1) AND (field_two LIKE 'something')

I need everything in between single quote to be from a color. I see the StartStopKeyEdit but it wont work for the same character. Any chance of accomplish this?

Cheers.
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Re: hpwPlusMemo

Post by HPW »

A regex might work:

Code: Select all

[RegExKeywords]
^'.*'$=0,0,1,0,-1,255,0,0,
This regex need a word boundery before and after the string:
So 'Test' work but 'Test') will also Color the closing paranthese. But you may add a space: 'Test' )
Not sure if other regex might work better.

Regards
Hans-Peter
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Re: hpwPlusMemo

Post by HPW »

Seems I make a mistake:
I tested in paralel a StartStopKey and this seems to do it:

Code: Select all

[Sections]
'|'=1,0,3,0,-1,16711680,3,0,0,
So not the regex.

Regards
Hans-Peter
User avatar
stu
Posts: 322
Joined: Wed Aug 07, 2013 11:37 am

Re: hpwPlusMemo

Post by stu »

HPW wrote:Seems I make a mistake:
I tested in paralel a StartStopKey and this seems to do it:

Code: Select all

[Sections]
'|'=1,0,3,0,-1,16711680,3,0,0,
So not the regex.

Regards
Awesome, thanks for your help!
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Re: hpwPlusMemo

Post by HPW »

Hello,

I was asked how a hotspot is defined in PlusMemo:

In your keyword config give the wanted hotspot keyword a unique content id.
Here it is the 10 in third param.

define=2,0,10,-21,-1,16711680,0,0,

With the -21 in fourth param you tell plusmemo to show the Hand-Cursor when mouse over the keyword. (See MouseCursor.txt for possble Cursor)

See page-Action the Content of "[RPlusMemo1_ContextAction]":

Code: Select all

hpwPlusMemoSetVar "[RPlusMemo1_ContextAction]" "If [#34][#91]RPlusMemo1_ContextNum[#93][#34] [#34]=[#34] [#34]10[#34][#13][#10]  AlertBox [#34]ContextAlert[#34] [#34]Context: [#91]RPlusMemo1_ContextNum[#93] = [#91]RPlusMemo1_ContextStr[#93][#34][#13][#10]Endif"
The context-action is fired when you click in plusmemo-text. With the returned context-id you can check if this keyword is used as a hotspot and fire the wanted action. Alternativly you can check the string in RPlusMemo1_ContextStr.

Hope this helps.

Regards
Hans-Peter
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Re: hpwPlusMemo

Post by HPW »

Just released hpwPlusMemo 1.11:

http://www.hpwsoft.de/anmeldung/html1/n ... ook16.html

New variable [RectangleName_InternalPopupCaption0] for setting caption-text of 'Undo' in internal popup-menu.
New variable [RectangleName_InternalPopupCaption1] for setting caption-text of 'Redo' in internal popup-menu.
New variable [RectangleName_InternalPopupCaption3] for setting caption-text of 'cut' in internal popup-menu.
New variable [RectangleName_InternalPopupCaption4] for setting caption-text of 'copy' in internal popup-menu.
New variable [RectangleName_InternalPopupCaption5] for setting caption-text of 'paste' in internal popup-menu.
New variable [RectangleName_InternalPopupCaption7] for setting caption-text of 'select all' in internal popup-menu.
The new variables allows translation into other languages.

Bugfix: Wizard of hpwPlusMemoSetVar was throwing access violation sometimes.

Regards
Hans-Peter
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Re: hpwPlusMemo

Post by HPW »

Just released hpwPlusMemo 1.12:

http://www.hpwsoft.de/anmeldung/html1/n ... ook16.html

Action: hpwPlusMemoActivatePopup - Activate/setup a custom popupmenu of the memo.
Action: hpwPlusMemoSetPopupItem - Set different propertys of a popup item.

Usefull when other entrys are needed as in the internal popup-menu. Similar to the popup in hpwImage.
Demo in page 2 of sample pub.

Regards
Hans-Peter
Locked