I'll stick with static images for now. (My GIf Anim have too many framesAivars wrote:Check out this demo plugin: http://forums.blumentals.net/viewtopic.php?f=33&t=5976
General discussion about plugins.
Re: General discussion about plugins.
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
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:
And in the "Ajax" function, I add items like this:
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?
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);
}
}
}
Code: Select all
var j = AutoComplete.AddItem(Strings, link, label);
AutoComplete.SetImageIndex(j, 4);
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.
The items I add to AutoComplete are returned in order of importance, not alphabetic.
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
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.
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
Re: General discussion about plugins.
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.
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.
Re: General discussion about plugins.
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
Re: General discussion about plugins.
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?
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.
Re: General discussion about plugins.
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.
One good strategy for cases like this is to write a log file to find out where the crash occurred.
Blumentals Software Programmer
Re: General discussion about plugins.
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? 2) According to http://help.blumentals.net/webuilder/pl ... lasses.htm, the TForm object has a "Canvas" property.
But how is that used? Can it be used to draw custom shapes?
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? 2) According to http://help.blumentals.net/webuilder/pl ... lasses.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.
Re: General discussion about plugins.
Try adding
PSForm.DoubleBuffered = true;
right after PSForm is created.
PSForm.DoubleBuffered = true;
right after PSForm is created.
Blumentals Software Programmer
Re: General discussion about plugins.
Thanks. That was exactly what was neededAivars wrote:Try adding
PSForm.DoubleBuffered = true;
right after PSForm is created.
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
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:
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.
Re: General discussion about plugins.
Im trying to get a list of browsers installed on system, like this:
But it always fails running the "reg.exe" (Doesn't matter if I use 32 or 64 bit versions.) with this output:
Command: C:\Windows\System32\reg.exe query "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet" 2>nul
Result: ERROR: Invalid syntax.
Type "REG QUERY /?" for usage.
If I copy "Command:" output and paste it into a DOS prompt, it WORKS. So why doesn't it work using "ExecuteCommand" ?
Code: Select all
var res32, res64;
var reg32 = "C:\\Windows\\System32\\reg.exe";
var reg64 = "C:\\Windows\\SysWOW64\\reg.exe";
var key32 = reg32 + " query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Clients\\StartMenuInternet\" 2>nul";
var key64 = reg64 + " query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Clients\\StartMenuInternet\" 2>nul";
Script.Message("Command: " + _t(key32));
ExecuteCommand(key32, res32);
Script.Message("Result: " + _t(res32));
Command: C:\Windows\System32\reg.exe query "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet" 2>nul
Result: ERROR: Invalid syntax.
Type "REG QUERY /?" for usage.
If I copy "Command:" output and paste it into a DOS prompt, it WORKS. So why doesn't it work using "ExecuteCommand" ?
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
Nevermind. I figured out what was wrong (Was missing a \ at the end)
There are 10 types of people in the world: Those who understand binary and those who don't.
Re: General discussion about plugins.
Alright. On unrelated note, I don't think you will get different directories via system32\ and syswow64\ from 32-bit application 
Blumentals Software Programmer
Re: General discussion about plugins.
Yeah. I discovered that too.Aivars wrote:Alright. On unrelated note, I don't think you will get different directories via system32\ and syswow64\ from 32-bit application
I got it working now, so I can extract the installed browser names and the path to the executable.
Code: Select all
var WSO = CreateOleObject("Wscript.Shell");
var winDir = WSO.ExpandEnvironmentStrings("%windir%");
var SL = new TStringList;
ExecuteCommand(winDir + "\\System32\\reg.exe query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Clients\\StartMenuInternet\"", SL.Text);
if (SL.Count<4) return; // Something went wrong
for (var i = 4;i < SL.Count;i++) {
var name = WSO.RegRead(SL[i] + "\\"); // Browser name
if (name == "") name = RegexMatch(SL[i], "[^\\\\]*$", false);
Sender.Items.Add(name);
}
There are 10 types of people in the world: Those who understand binary and those who don't.