docs: update nwn-2-gui-scripting
This commit is contained in:
parent
5a86c84b06
commit
1dda72a42f
1 changed files with 79 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
|||
title: Nwn 2 Gui Scripting
|
||||
description: A quick summary of Nwn 2 Gui Scripting
|
||||
published: 1
|
||||
date: 2020-01-10T23:05:32.063Z
|
||||
date: 2020-01-12T19:52:27.380Z
|
||||
tags:
|
||||
---
|
||||
|
||||
|
@ -329,6 +329,8 @@ Inherits from UIPane element.
|
|||
| `disabledcolor` | Color to blend when the button is disabled | Hexadecimal color (ie `ff00ff`) |
|
||||
| `disabledtextcolor` | Color to blend with the button text when the it is disabled | Hexadecimal color (ie `ff00ff`) |
|
||||
| `style=""` | Name of an UIButton style defined in `stylesheet.xml`. The button will inherit all attributes values from its style | See `stylesheet.xml` |
|
||||
| `header=false` | This button is the UICollapsable's header button | Boolean |
|
||||
| | | |
|
||||
|
||||
|
||||
## Children
|
||||
|
@ -367,10 +369,83 @@ Define one of these children inside the UIButton element will override the style
|
|||
|
||||
# UICollapsable
|
||||
# UIGrid
|
||||
|
||||
|
||||
|
||||
# UIListBox
|
||||
|
||||
Notes:
|
||||
- Hiding the listbox scrollbar can cause issues because when you empty/re-fill it, the scrollbar position may be kept.
|
||||
UIListBoxes serve two purposes:
|
||||
- Provide a scrollable view, where elements are dynamically placed top to bottom
|
||||
- Provide a container that can be filled with rows by some NWScript
|
||||
|
||||
## Attributes
|
||||
|
||||
| Attribute | Usage | Possible values |
|
||||
|------------------------------------|---------------------------------------------------------------------------------------------------------------------|-----------------|
|
||||
| `showpartialchild=true` | `false` will hide children that don't have enough space to be fully displayed | Boolean |
|
||||
| `unequalcontrols` | Set to `false` if each listbox child has the same height, to improve scrolling performance. Set to `true` otherwise | Boolean |
|
||||
| `xPadding` | Horizontal space between two children of the listbox | Integer |
|
||||
| `yPadding` | Vertical space between two children of the listbox | Integer |
|
||||
| `snaptobottom=false` | `true` will keep the listbox scrolled all the way down when adding children | Boolean |
|
||||
| `scrollsegmentsize` | Number of pixels the listbox content is moved when scrolling it with the wheel or by clicking the scrollbar arrows | Integer |
|
||||
| `scrollbaronright=true` | Set to `false` to move the scrollbar to the left side of the listbox | Boolean |
|
||||
| `selectonleftclick=false` | If `true`, clicking a row will make it selected (probably for `listboxtext:LBName.UITxtName` __need info__) | Boolean |
|
||||
| `hidescrollbarwhennotneeded=false` | If `true` the scrollbar will be hidden when scrolling is not necessary. | Boolean |
|
||||
| `hidescrollbar=false` | `true` to always hide the scrollbar | Boolean |
|
||||
| `` | | |
|
||||
|
||||
### Notes
|
||||
- `hidescrollbarwhennotneeded` `hidescrollbar`: It is better to keep those to `false`, as sometimes the scroll position
|
||||
is kept when removing/adding content, and you can end up having a UIListbox with some content but no visible scrollbar nor children.
|
||||
|
||||
## Children
|
||||
|
||||
If no `y` position is defined, children of a listbox are dynamically placed from top to bottom.
|
||||
|
||||
|
||||
### Prototypes
|
||||
|
||||
If a child element has the attribute `prototype` set to `true`, the element will be used as a row template.
|
||||
The following functions in NWScript can interact with listbox rows:
|
||||
|
||||
##### ClearListBox
|
||||
```c
|
||||
void ClearListBox( object oPlayer, string sScreenName, string sListBox );
|
||||
```
|
||||
Remove all rows from a `UIListBox`
|
||||
- `oPlayer`: player object
|
||||
- `sScreenName`: `UIScene` `name` attribute
|
||||
- `sListBox`: `UIListBox` `name` attribute
|
||||
|
||||
|
||||
##### AddListBoxRow
|
||||
```c
|
||||
void AddListBoxRow( object oPlayer, string sScreenName, string sListBox, string sRowName, string sTextFields, string sTextures, string sVariables, string sHideUnhide );
|
||||
```
|
||||
Adds a new row into a `UIListBox`
|
||||
- `oPlayer`: player object
|
||||
- `sScreenName`: `UIScene` `name` attribute
|
||||
- `sListBox`: `UIListBox` `name` attribute
|
||||
- `sRowName`: a string identifier for the row (__needs testing__)
|
||||
- `sTextFields`: List of `UIText` elements to set the `text` attribute.
|
||||
+ Examples: `TEXT_ELEMENT_NAME=Hello world`, `ITEM_NAME=Great sword;PRICE=42` (TODO: test if the element test lookup
|
||||
is restricted to the listbox content, i.e. if there are issues if there are multiple elements with the same name)
|
||||
- `sTextures`: List of `UIFrame` (TODO: or `UIIcon` ?) elements to set the image/icon.
|
||||
+ Examples: `FRAME_ELEMENT_NAME=ia_attack.tga`, `ITEM_ICON=it_am_scalemail00.tga;ITEM_CAT_ICON=b_armor_normal.tga`
|
||||
- `sVariables`: GUI variables to set? (__needs testing__)
|
||||
- `sHideUnhide`: List of UI elements to show or hide.
|
||||
+ Examples: `ELEMENT_NAME=hide`, `BUTTON_ATTACK=hide;BUTTON_BEFRIENDS=show`
|
||||
|
||||
##### ModifyListBoxRow
|
||||
```c
|
||||
void ModifyListBoxRow( object oPlayer, string sScreenName, string sListBox, string sRowName, string sTextFields, string sTextures, string sVariables, string sHideUnhide );
|
||||
```
|
||||
Modifies an existing row inside a `UIListBox`. The parameters are the same as `AddListBoxRow`
|
||||
|
||||
## Special variables
|
||||
listboxrow:listboxname => row number?
|
||||
listboxtext:listboxname.textElementName => text content
|
||||
|
||||
|
||||
# UIScrollBar
|
||||
# UIProgressBar
|
||||
|
|
Loading…
Add table
Reference in a new issue