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: 371
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: 371
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: 1989
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: 371
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: 1989
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: 371
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: 1989
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby pmk65 » Tue Aug 01, 2017 1:50 pm

Two questions:

1) I have been playing a bit with TTimer, trying to animate an image. I tried 3 different ways: Sprite method (moving the image inside a TPanel), Visibility method (turining on/off visibility of the frames) and Copy method (Copy the source of the image from a sequence of preloaded images)
Im not sure if Im doing something wrong, but all of them has a big flaw. They flicker! :(
Attached is a testplugin showing the 3 animation methods. Maybe you could take a look at it?
AnimationTest.zip
Test plugin with 3 Animation methods: Sprite, Copy & Visibility.
(21.8 KiB) Downloaded 9 times


2) According to http://help.blumentals.net/webuilder/plugins/develop/api_classes.htm, the TForm object has a "Canvas" property.
But how is that used? Can it be used to draw custom shapes?
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 371
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby Aivars » Sat Aug 05, 2017 4:21 pm

Try adding
PSForm.DoubleBuffered = true;
right after PSForm is created.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 1989
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby pmk65 » Sun Aug 06, 2017 6:12 pm

Aivars wrote:Try adding
PSForm.DoubleBuffered = true;
right after PSForm is created.


Thanks. That was exactly what was needed :)
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 371
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Postby pmk65 » Tue Aug 08, 2017 12:58 pm

I have been experimenting with the TForm Events, trying to see if I could draw on Canvas. But I can't get it to trigger the "OnCreate" Event.

The TForm Events is fired in this order (excl. the mouse and key events.)

On creating/showing the form, these events are triggered:
OnResize
OnShow
OnResize
OnActivate
OnPaint

On closing the form, these events are triggered:
OnCloseQuery
OnClose
OnDeactivate
OnHide
OnDestroy

But the "OnCreate" is never triggered.

Edit: I figured out how to use the TForm Canvas drawing options. In the TForm setup, add an "OnPaint" event and a function like this:

Code: Select all
function OnPaint(Sender) {
        // Draw a Green Circle
   Sender.Canvas.Brush.Style = bsClear;
   Sender.Canvas.Pen.Style = psSolid;
   Sender.Canvas.Pen.Color = clGreen;
   Sender.Canvas.Pen.Width = 20;
   Sender.Canvas.Ellipse(100, 100, 200,200);

        // Write the word "WeBuilder" in Green letters
   Sender.Canvas.Font.Color = clRed;
   Sender.Canvas.Font.Size = 20;
   Sender.Canvas.TextOut(100, 100, "WeBuilder");
}
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 371
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Previous

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

Who is online

Users browsing this forum: No registered users and 1 guest

cron