General discussion about plugins.

Browse, download and discuss plugins for Blumentals code editors

Re: General discussion about plugins.

Postby pmk65 » Mon Mar 27, 2017 12:55 am

Aivars wrote:Check out this demo plugin: viewtopic.php?f=33&t=5976


I'll stick with static images for now. (My GIf Anim have too many frames :D)
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 325
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby pmk65 » Mon Mar 27, 2017 12:57 am

I have been playing a bit with "AutoComplete", and got most of it working so far.
Except setting the default item in the dropdown list. (And I still have no clue what AKey is used for :?)

Here's my code:
Code: Select all
function OnAutoComplete(CodeType, ACType, Strings, AKey, AllowPopup, ShowImages) {
   if ((ACType == 2) && (CodeType == 1) && (Strings[0] == "{\\rtf\\b Choose URL... }")) {
      var word = AutoComplete.GetWordBeforeCursor("");
      if (word != "") {
         Script.Message("word:" + word);
         ShowImages = true;
         AllowPopup = true;
         Ajax(word, Strings);
      }
   }
}


And in the "Ajax" function, I add items like this:
Code: Select all
var j = AutoComplete.AddItem(Strings, link, label);
AutoComplete.SetImageIndex(j, 4);


So when you activate the autocomplete inside a JavaScript "src" field, the plugin code is triggered.
This partly works as it should (I still need to figure out a way to trigger it only on JavaScript tags), but it start with the 1st item selected in the list displayed.
:?: How do I get it to start at the X position in the list?

The items I add to AutoComplete are returned in order of importance, not alphabetic.
:?: Is it possible to turn of the alphabetic sorting of the list, and instead display it in the order they are added?

:?: Also, "GetWordBeforeCursor" requires a string argument, but what is it for?
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 325
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby Aivars » Mon Mar 27, 2017 6:10 pm

1) The selected word will try to match the word that is before the cursor to codeword (e.g. if you have "script" before the cursor then "script" is selected from the list).

2) The AddItem method will add items sorted by codeword.

3) Let's suppose you have Dog.Bark right before cursor. Calling GetWordBeforeCursor with empty string will only get you "Bark", calling GetWordBeforeCursor(".") will get you "Dog.Bark". It's basically a list of additional characters (besides basic alphanumeric) to consider to be a part of the word.

AKey is key that triggered the autocmplete. E.g. user wrote <scr, then waited - in this carse AKey will match "r". If AKey is "!" that means user pressed ctrl + space.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 1938
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby pmk65 » Thu Apr 20, 2017 7:08 pm

Is there any way to intercept the result selected in "onautocomplete" function?

As the sorting of the items prevents my new CDNJS plugin from working correctly. ( I need the items to be displayed in the order I add them, not in sorted order)
So I was thinking of adding a digit string to each item as I add them to the list. And then remove the digit string again before the selected result is inserted in the editor.
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 325
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby Aivars » Fri Apr 21, 2017 11:51 am

Currently, no, but technically it could be done because e.g. Choose Image... is replaced with whatever image the user select from the Open dialog. But I would need to add the relevant signals for this to work, so most likely for the next major version only.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 1938
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby pmk65 » Mon Apr 24, 2017 8:04 pm

I get random crashes (the ones that shows the Recovery panel) and Im pretty sure it comes from a plugin Im working on. I just can't pinpoint the problem.
Is there any way for normal users, to use the debug info from the Recovery window, to locate errors in plugins?
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 325
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby Aivars » Mon May 01, 2017 1:01 pm

If the crash is inside the scripting library it's usually hidden too well to figure out the crash location from stack log. If it happens in a function that got called from the scripting library then it's possible to at least determine what was called. If you pasted me a few top lines from the stack dump and provide exception name & message, I could take a look.

One good strategy for cases like this is to write a log file to find out where the crash occurred.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 1938
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Previous

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

Who is online

Users browsing this forum: No registered users and 0 guests

cron