General discussion about plugins.

Browse, download and discuss plugins for Blumentals code editors

Re: General discussion about plugins.

Postby pmk65 » Tue Nov 01, 2016 2:41 pm

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.
User avatar
pmk65
 
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby Aivars » Tue Nov 01, 2016 6:16 pm

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
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby pmk65 » Fri Nov 04, 2016 3:33 pm

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:
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");


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.)
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby Aivars » Fri Nov 04, 2016 5:04 pm

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
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby Aivars » Mon Nov 14, 2016 7:42 pm

High-DPI issue and how to fix it explained here: viewtopic.php?f=4&t=7074
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby Aivars » Mon Nov 14, 2016 8:18 pm

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
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby pmk65 » Thu Nov 17, 2016 6:18 pm

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/plugins/develop/api_classes.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.
User avatar
pmk65
 
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby Aivars » Thu Nov 17, 2016 6:30 pm

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
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby pmk65 » Fri Nov 18, 2016 2:07 pm

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. :P
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.
User avatar
pmk65
 
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby pmk65 » Mon Feb 20, 2017 6:51 pm

Could you provide some example code on how to use "AutoComplete" functionality?

There's a very limited example here: viewtopic.php?f=33&t=5969&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);
    }


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 are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby Aivars » Mon Feb 20, 2017 11:01 pm

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
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby pmk65 » Thu Mar 16, 2017 12:55 am

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.


I don't have any plugin using the functionality yet. Im just experimenting to see if I could figure out how it works first.
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.
User avatar
pmk65
 
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby Aivars » Thu Mar 16, 2017 4:22 pm

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
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby pmk65 » Thu Mar 16, 2017 9:29 pm

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.


Can you provide a small code example for using TImage / TTimer?
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.
User avatar
pmk65
 
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby Aivars » Fri Mar 17, 2017 1:08 pm

Check out this demo plugin: viewtopic.php?f=33&t=5976
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

PreviousNext

Return to Plugins for HTMLPad / Rapid CSS / Rapid PHP / WeBuilder

Who is online

Users browsing this forum: No registered users and 7 guests