How to add heading in the action list - Forum

Forum Navigation
You need to log in to create posts and topics.

How to add heading in the action list

1- How to add heading in the action list.

2- nbfiletostream function is not defined, how can I use it?

Uploaded files:
  • You need to login to have access to uploads.

Hello,

1: nbAddAction( 0, PChar('MyHeading'), '',[ACTIONPARAM_NONE], 0 );

2: Do you have PlugInUtils.pas in your uses section? There it is defined.

Regards

Hans-Peter

 

Hi,

This is the way how I do it:

nbAddAction( 0, 'Head title', '', [], 0 );

 

-

Question, guys:

If I use some dialog to select any file from the plugin, How can I save the selected file into the plugin using nbFileToStream? I don't find a way to make it work :/

I would like to access/read the selected file at runtime. Hope it can be possible, thanks.

 

Hello,

nbFileToStream is not made for accessing files in a plugin. It is for reading files from the embedded files of VNW into plugins/VNW memory from a plugin. When you want to save data into your plugin, I think a way would be to save them into the reources and extract it from there. But just a thought and untested. Another option is the baggage feature of the plugin-interface. There you add a file to the plugin-dll and it is unpacked on plugin load. You can also think about a zip to pack your files and deliver it with your plugin.

Regards

Hans-Peter

Hi, @hpw

Thanks a lot for clarifying me about nbFileToStream (I didn't know...) and the ideas.

So if I have embedded a small image " [Embedded]MyImage.jpg ", how can I read this image and use it in a TImage? Or maybe you have a couple of code lines to make it work (Hoping it is not too difficult). Thanks, thanks for your time.

Hello,

From the SDK CHM help file for nbFileToSTream:

FUNCTION StreamFileToMemo( CONST FileName : STRING ) : BOOLEAN;

VAR Stream : IStream;

    Ole    : TOleStream;

BEGIN

  Result := FALSE;

  IF Assigned( nbFileToStream ) THEN

    BEGIN

      IF nbFileToStream( PChar( FileName ), Stream ) THEN

        TRY

          Ole := TOleStream.Create( Stream );

          TRY

            { Load the file from the stream into a memo... }

            Memo1.Lines.LoadFromStream( Ole );

          FINALLY

            Ole.Free;

          END;

        FINALLY

          { Release the IStream... }

          Stream := NIL;

        END

      ELSE ShowMessage( 'File not found.' );

    END

  ELSE ShowMessage( 'This feature requires NeoBook 5.0.0 or higher.' );

END;

Your have to read the delphi-Method for LoadFromStream for TImage of cource.

Regards

Hans-Peter

 

 

Vadim has reacted to this post.
Vadim

Hi, @hpw

I already know this function is in the help but is not defined in the SDK (or samples) (as you can read in first  @ruby post), so I tried before your reply and it didn't never work (internal error when playing an action).

Many thanks.

Hello,

As writen in my first post you have to link the PlugInUtils.pas.

But I see that there are different version in the SDK sub folders.

Take the one from ...\PlugIn SDK\Delphi Examples\SpinEdit Example\

There you have this vars:

VAR

nbGetVar : TVarGetProc;
nbSetVar : TVarSetProc;
nbPlayAction : TPlayActionProc;
nbInterface : TInterfaceProc;
nbFileToStream : TStreamProc;
nbAddFile : TAddFileProc;
nbAddAction : TAddActionProc;
nbWinHandle : HWND;

Regards

Hans-Peter

@hpw

Yes, that is ok, but the problem that occurred was on the procedure nbRegisterPlugIn at runtime. Thanks, I will try another way.

Hello,

You have to debug your nbRegisterPlugIn function step by step to catch the error.

Regards

Hans-Peter