Pro text/hex editor
with Binary Templates

SweetScape Knowledgebase

KB1036: How do I define a struct that moves with the cursor?

There are three different ways to add structs that move with the cursor in 010 Editor. If you would like the struct to always be available on every file you edit, you may add structs directly to the Auto tab of the Inspector window. To do this, right click on the Auto Inspector and choose 'Customize...' from the right click menu, then select Use Custom Template and then click the Edit button. In the 'Inspector.bt' file that is opened, add the struct you would like displayed. For example:

     FSeek(pos);
     struct MYSTRUCT
     {
         int id;
         int value;
     } data;

Save the template and then when the cursor moves in a file, the struct will automatically be defined at the cursor position.

The second way is to place your struct in a template and use the statement 'FSeek(GetCursorPos());' before you define your structure. For example:

     FSeek(GetCursorPos());
     SetBackColor( cLtAqua );
     struct MYSTRUCT
     {
         int id;
         int value;
     } data;
     SetBackColor( cNone );

This structure also has a background color so its easier to tell where the structure is placed in your file. To move the structure, move your cursor in the file and then press the F5 key to re-run the template.

The third way is to run a Template on your file that contains the structs you want to use. Then you can create a custom bookmark using the types from that template (see KB1020 for more information). When you create the bookmark, make sure the Move Bookmark with Cursor toggle is enabled in the Add Bookmark dialog. After the bookmark is created, moving your cursor around the file will cause the struct to be moved with your cursor.




Newsletter - Receive special offers, tips, tricks and news. Join now

010 Editor v15.0.1 is here!
What's new?



E-mail: info@sweetscape.com