# Gear Form This page is about {ref}`Gear Layouts` dedicated `TLazForm` utilities. This is meant to be used with {ref}`TScriptForm` with {ref}`TScriptForm.CreateGearTab` and will setup a a `TLazTabSheet` on it with several controls to configure the {ref}`Gear Layouts`: ```{figure} ../../images/gearform.png ``` - - - ## TGearFormHelper The `TGearFormHelper` type is, as it's name implies a helper type for the `Gear Form`. It has a lot of methods and callbacks that are hidden by default and won't be mentioned on this page because they are internal methods you shouldn't touch. Do feel free to read the source code though if you so desire. - - - ## TGearFormHelper._Sprite ```pascal function TGearFormHelper._Sprite(id: Integer): TSpriteDefinition; ``` Internal method that reads the first frame of sprite archive `id` out of the game cache. - - - ## TGearFormHelper.LoadBackground ```pascal procedure TGearFormHelper.LoadBackground(); ``` Fills `TGearFormHelper.BackgroundImg` with the empty gametab background and draws the equipment interface onto it out of the game cache, so the slot frames and the silhouette each empty slot shows are the ones the client itself draws. The frames go at {ref}`TEquipment.GetSlots` positions, the same boxes the form draws items into, and every silhouette is placed by the offset its own sprite carries. The bars joining the slots belong to no slot, so they carry the interface's own coordinates. - - - TGearFormHelper.LoadBackground ------------------------------ ``` procedure TGearFormHelper.LoadBackground() ``` - - - ## TGearFormHelper.SlotImage ```pascal function TGearFormHelper.SlotImage(item: String): TImage; ``` Returns the slot frame with `item` drawn into it. The result is kept, keyed by the item, because a redraw asks for the same frames over and over and each one costs a copy of `TGearFormHelper.SlotImg`. - - - ## GearForm.CreateGearCombobox ```pascal function TGearFormHelper.CreateGearCombobox(owner: Pointer; caption: TLazLabel = nil): TLazComboBox; ``` This is the only method from {ref}`Gear Form` you might need to use. This will create a combobox for you whose contents auto-update with changes made on the `Gear Form`. - - - ## GearForm variable Global {ref}`TGearFormHelper` variable. - - - ## ScriptForm CreateGearTab ```pascal function TScriptForm.CreateGearTab(): TLazTabSheet; ``` Sets up a `TLazTabSheet` on your `TScriptForm` to configure your `Gear Layouts`. Example: ```pascal {$I WaspLib/main.simba} var form: TScriptForm; begin form.Setup(); form.CreateGearTab(); form.Run(); end. ``` ```{figure} ../../images/gearform.gif ``` For a more complete example check out the file `Simba/Includes/WaspLib/examples/gear_form.simba`.