General discussion about plugins.
Re: General discussion about plugins.
I tried adding myform.Scaled = true and false but it didn't have any effect on the output.
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
Alright, I'm adding this to my Todo. I'll figure out what would be the best way to deal with text zoom.
Blumentals Software Programmer
Re: General discussion about plugins.
I have a problem with "keypress" event. (Im not sure if it's a bug, or it's just not possible).
The following code illustrates the problem:
When the above is added to a plugin, then pressing the "z" key will instead show a "X" in the editor. (This works correctly.)
And when pressing Return/Enter it should show a "L" instead of a linefeed. But no "L" is displayed and it still makes a linefeed. (What I need it to suppress the linefeed and setting key="" doesn't have any effect either.)
The following code illustrates the problem:
Code: Select all
// Fired when user pressed key in editor area. Key can be changed or set to empty string to disable the keypress.
function OnKeypress(key) {
if (key == chr(13)) {
Script.Message("Instead of linebreak you should see an 'L'");
key = "L";
}
else if (key == "z") {
Script.Message("Instead of a 'z' you should see an 'X'");
key = "X";
}
}
Script.ConnectSignal("keypress", "OnKeypress");
And when pressing Return/Enter it should show a "L" instead of a linefeed. But no "L" is displayed and it still makes a linefeed. (What I need it to suppress the linefeed and setting key="" doesn't have any effect either.)
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
I'm not sure why Enter would be any different than regular letters, I'll figure this out and let you know.
Blumentals Software Programmer
Re: General discussion about plugins.
High-DPI issue and how to fix it explained here: http://forums.blumentals.net/viewtopic.php?f=4&t=7074
Blumentals Software Programmer
Re: General discussion about plugins.
Regarding newline - it kind of is processed in both Keydown and Keypress events internally for various reasons, so the way to go about it is:
Code: Select all
function OnKeypress(key) {
if (key == chr(13)) {
key = "L";
}
}
function OnKeydown(key, shift) {
if (key == chr(13)) {
key = "L";
}
}
Script.ConnectSignal("keypress", "OnKeypress");
Script.ConnectSignal("keydown", "OnKeydown");
Blumentals Software Programmer
Re: General discussion about plugins.
Thanks for the explanation of the newline "problem" 
Another question:
Is this possible with the current plugin form features?
I want to setup a TRichText field (similar to a TMemo, except it supports colors)
And then let the user enter text in the field. (This works)
Then when the user doubleclicks on a specific line, I want to change the color of the line. (Simplified explanation)
So what I need is a way to determine which line/column the user clicked. And a way to manipulate that.
From looking at the Class properties: http://help.blumentals.net/webuilder/pl ... lasses.htm
It doesn't look like any properties for positioning is implemented or am I wrong?

Another question:
Is this possible with the current plugin form features?
I want to setup a TRichText field (similar to a TMemo, except it supports colors)
And then let the user enter text in the field. (This works)
Then when the user doubleclicks on a specific line, I want to change the color of the line. (Simplified explanation)
So what I need is a way to determine which line/column the user clicked. And a way to manipulate that.
From looking at the Class properties: http://help.blumentals.net/webuilder/pl ... lasses.htm
It doesn't look like any properties for positioning is implemented or am I wrong?
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
I think this might be too much for the simple plugin system
Have you considered using ScriptabeWebkit instead? (http://help.blumentals.net/webuilder/pl ... amples.htm - WebKit dialogs). You can then use HTML and full JavaScript (including all available JavaScript libraries) to make anything.

Blumentals Software Programmer
Re: General discussion about plugins.
Ok.
it's an existing plugin that already uses a TMemo form element. I was just hoping there was some controls available for TMemo/TRichText for manipulating positions.
I'll find another way to accomplish my goal.
it's an existing plugin that already uses a TMemo form element. I was just hoping there was some controls available for TMemo/TRichText for manipulating positions.

I'll find another way to accomplish my goal.

There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
Could you provide some example code on how to use "AutoComplete" functionality?
There's a very limited example here: http://forums.blumentals.net/viewtopic. ... 9&start=30
But it only describes the "AddItem" function. I miss information/sample on how to use:
- AutoComplete.Clear(Strings: TStrings)
- AutoComplete.GetWordBeforeCursor(AdditionalChars: string): string
- AutoComplete.Count(Strings: TStrings): Integer
- AutoComplete.GetCodeWord(idx: Integer): string
- AutoComplete.SetImageIndex(ItemIndex, ImgIndex: Integer)
- AutoComplete.GetFunctionData(LookupType: string; var Name, ObjName, ObjClass, ObjSignature: string; var Param, Start: Integer)
- AutoComplete.FormatActiveParam(s: string; Param: Integer): string
- AutoCompleteLibrary.AddPHPEntry(LibraryName: string; ItemType: TPhpItemType; Name, Description, Inheritance: string; Scope: TPhpItemScope; IsStatic: Boolean; Arguments: string; ClassName, ClassExtends, Returns: string) -
And what is the various parameters used for. Like: AKey, CodeWord, CodeType etc.
I find it hard to figure out if it's a parameter I have to set, or if it's a return value.
I got a list of keywords I want to add to autocomplete like this:
Sometimes (when using HTML CodeType), it inserts the auto completed text at the TOP of the editor instead of at cursor position. (Probably because I don't know how to call the functions correctly without knowing what the parameters are used for.)
And Im having problems triggering the AutoComplete popup. It works the 1st time, but after that nothing.
There's a very limited example here: http://forums.blumentals.net/viewtopic. ... 9&start=30
But it only describes the "AddItem" function. I miss information/sample on how to use:
- AutoComplete.Clear(Strings: TStrings)
- AutoComplete.GetWordBeforeCursor(AdditionalChars: string): string
- AutoComplete.Count(Strings: TStrings): Integer
- AutoComplete.GetCodeWord(idx: Integer): string
- AutoComplete.SetImageIndex(ItemIndex, ImgIndex: Integer)
- AutoComplete.GetFunctionData(LookupType: string; var Name, ObjName, ObjClass, ObjSignature: string; var Param, Start: Integer)
- AutoComplete.FormatActiveParam(s: string; Param: Integer): string
- AutoCompleteLibrary.AddPHPEntry(LibraryName: string; ItemType: TPhpItemType; Name, Description, Inheritance: string; Scope: TPhpItemScope; IsStatic: Boolean; Arguments: string; ClassName, ClassExtends, Returns: string) -
And what is the various parameters used for. Like: AKey, CodeWord, CodeType etc.
I find it hard to figure out if it's a parameter I have to set, or if it's a return value.
I got a list of keywords I want to add to autocomplete like this:
Code: Select all
for (var i=0;i<triggerList.Count;i++) {
var key = triggerList[i];
AutoComplete.AddItem(Strings, key, key);
}
And Im having problems triggering the AutoComplete popup. It works the 1st time, but after that nothing.
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
Maybe you could PM me your work-in-progress plugin and I could try to fix it? I have a privilege of looking at the source code of the auto-complete functionality so if anything doesn't work or needs some specific parameters or calling order, it would be easier for me to work on an actual script and then explain what and why the various functions and parameters do; and then I could try to document them.
Blumentals Software Programmer
Re: General discussion about plugins.
I don't have any plugin using the functionality yet. Im just experimenting to see if I could figure out how it works first.Aivars wrote:Maybe you could PM me your work-in-progress plugin and I could try to fix it? I have a privilege of looking at the source code of the auto-complete functionality so if anything doesn't work or needs some specific parameters or calling order, it would be easier for me to work on an actual script and then explain what and why the various functions and parameters do; and then I could try to document them.
It's hard to write a plugin when you are not 100% sure what is possible with the functions and how they work

Another question: Is it possible to display an animated "spinner" in a plugin form?
I want to show some indication like a spinner, when the plugin is processing stuff in the background.
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
Sure, one way to do it is to swap images (TImage) from timer. This will work unless the plugin does some work that blocks UI. In that case it's better to offload the work to Webkit and display the spinner in the browser, because it will work in a different thread, thus not blocking UI.
Blumentals Software Programmer
Re: General discussion about plugins.
Can you provide a small code example for using TImage / TTimer?Aivars wrote:Sure, one way to do it is to swap images (TImage) from timer. This will work unless the plugin does some work that blocks UI. In that case it's better to offload the work to Webkit and display the spinner in the browser, because it will work in a different thread, thus not blocking UI.
I would rather avoid Webkit, as it takes a while before it is loaded/ready.
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
Check out this demo plugin: http://forums.blumentals.net/viewtopic.php?f=33&t=5976
Blumentals Software Programmer