Skip to content

AddEntry

Otavio edited this page Jul 20, 2021 · 8 revisions

CWidgets::AddEntry

What it does:

This function adds a new entry inside the widget. In other words, it adds a option to a list.

Parameters:

This function takes a std::string and a optional unsigned int as arguments. The arguments are the entry name and the entry value (defaults to 0 or false)

NOTE: You don't need to set the entry value.

Widgets:

List of widgets that are using this function:

  • MultiBox
  • ComboBox
  • ListBox
  • ItemSelector

Setting up a list

Here's how you can add a entry to one of these widgets.

I'll be using a ListBox as an example.

buildrPattern.Widget(ListBox).Title("ListBox").Font("Tahoma", 12).Position(30, 30).Size(200, 300)
.Entry("Entry 1")
.Entry("Entry 2")
.Entry("Entry 3")
.Entry("Entry 4")
.Entry("Entry 5")
.Entry("Entry 6")
.Entry("Entry 7")
.Entry("Entry 8")
.Entry("Entry 9")
.Entry("Entry 10").SpawnIn(Container);

NOTE: There's an extra function added into the pattern: Entry. This function takes the name of the entry, but you see that I'm not setting a custom value, as I said, its not mandatory.

After adding this into your menu, You should have a ListBox with 10 entries.

You can call Entry() inside a loop, to make your life easier or use the Entries() function.


What's next?

Next you will learn about the GetPosition function.