StatusBar Class

 

 

About StatusBar Class

 

StatusBar class is mainly used for creating and managing status bars.

 

StatusBar Class Methods

 

StatusBar.Create( long ParentHandle, long Style, long ExStyle ) creates a status bar. If the function succeeds, the return value is a handle to the new control. If the function fails, the return value is 0.

long ParentHandle: a handle to the parent or owner control of the control being created.
long Style: the style of the control being created. This parameter can be a combination of the window styles and status bar styles.
long ExStyle: the extended style of the control being created. This parameter can be a combination of the extended window styles.

 

StatusBar.Exists( long StatusBarHandle ) returns true if the specified control was created with StatusBar.Create() method and not destroyed yet or false otherwise. Note that all child controls are destroyed when parent control is destroyed. You can also call Control.Destroy() method for destroying a specific control with all of its children.

long StatusBarHandle: status bar handle.

 

StatusBar.Count() returns the total number of controls created with StatusBar.Create() method and not destroyed yet. Note that all child controls are destroyed when parent control is destroyed. You can also call Control.Destroy() method for destroying a specific control with all of its children.

 

StatusBar.GetHandleByIndex( ulong StatusBarIndex ) returns the handle from an index if the specified control was created with StatusBar.Create() method and not destroyed yet or 0 otherwise. Note that all child controls are destroyed when parent control is destroyed. You can also call Control.Destroy() method for destroying a specific control with all of its children. StatusBarIndex parameter should be less or equal to StatusBar.Count()-1.

ulong StatusBarIndex: zero-based index of the status bar.

 

StatusBar.SetParts( long StatusBarHandle, long Parts ) sets the number of parts for the specified status bar. The function returns true if successful, or false otherwise.

long StatusBarHandle: status bar handle.
long Parts: number of parts to set (cannot be greater than 256).

 

StatusBar.GetParts( long StatusBarHandle ) returns the number of parts in a status bar. The function returns true if successful, or false otherwise.

long StatusBarHandle: status bar handle.

 

StatusBar.SetPart( long StatusBarHandle, ulong PartIndex, long Position, long IconHandle, string Text ) sets the position, icon and text of the given part in a status bar.

long StatusBarHandle: status bar handle.
ulong PartIndex: zero-based index of the part.
long Position: position of the part. If this parameter is -1, the right edge of the corresponding part extends to the border of the window.
long IconHandle: icon handle.
string Text: text of the part.

 

StatusBar.SetPartPosition( long StatusBarHandle, ulong PartIndex, long Position ) sets the position of the given part in a status bar. The function returns true if successful, or false otherwise.

long StatusBarHandle: status bar handle.
ulong PartIndex: zero-based index of the part.
long Position: position of the part. If this parameter is -1, the right edge of the corresponding part extends to the border of the window.

 

StatusBar.GetPartPosition( long StatusBarHandle, ulong PartIndex ) returns the position of the given part in a status bar.

long StatusBarHandle: status bar handle.
ulong PartIndex: zero-based index of the part.

 

StatusBar.SetPartText long StatusBarHandle, ulong PartIndex, string Text ) sets the text to the specified part in a status bar. The function returns true if successful, or false otherwise.

long StatusBarHandle: status bar handle.
ulong PartIndex: zero-based index of the part.
string Text: text of the part.

 

StatusBar.GetPartText( long StatusBarHandle, ulong PartIndex ) returns the text from the specified part in a status bar.

long StatusBarHandle: status bar handle.
ulong PartIndex: zero-based index of the part.

 

StatusBar.GetPartTextLength( long StatusBarHandle, ulong PartIndex ) returns the length, in characters, of the text from the specified part in a status bar.

long StatusBarHandle: status bar handle.
ulong PartIndex: zero-based index of the part.

 

StatusBar.SetPartIcon long StatusBarHandle, ulong PartIndex, long IconHandle ) sets an icon to the specified part in a status bar.

long StatusBarHandle: status bar handle.
ulong PartIndex: zero-based index of the part.
long IconHandle: icon handle.

 

StatusBar.GetPartIcon( long StatusBarHandle, ulong PartIndex ) returns the icon from the specified part in a status bar.

long StatusBarHandle: status bar handle.
ulong PartIndex: zero-based index of the part.

 

StatusBar.SetColorBackground( long StatusBarHandle, long Color ) sets the background color in the status bar. Returns the previous background color, or CLR_DEFAULT if the background color is the default color. Note that this method turns off visual styles for the specified control in order to see the result.

long StatusBarHandle: status bar handle.
long Color: 24-bit color. Specifying the CLR_DEFAULT value causes the control to use its default color.

 

StatusBar.SetClicked( long StatusBarHandle, long Button, bool Clicked ) sets the click state of a status bar.

long StatusBarHandle: status bar handle.
long Button: this parameter can be 0 for left button, 1 for right button.
bool Clicked: sets the status bar as clicked (true) or not (false).

 

StatusBar.GetClicked( long StatusBarHandle, long Button ) returns true if the user clicks on the given status bar or false otherwise.

long StatusBarHandle: status bar handle.
long Button: this parameter can be 0 for left button, 1 for right button.

 

StatusBar.SetDoubleClicked( long StatusBarHandle, long Button, bool DoubleClicked ) sets the double click state of a status bar.

long StatusBarHandle: status bar handle.
long Button: this parameter can be 0 for left button, 1 for right button.
bool DoubleClicked: sets the status bar as double clicked (true) or not (false).

 

StatusBar.GetDoubleClicked( long StatusBarHandle, long Button ) returns true if the user double clicks on the given status bar or false otherwise.

long StatusBarHandle: status bar handle.
long Button: this parameter can be 0 for left button, 1 for right button.

 

Code Example

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Giavapps.Windows.API;

public class CodeExample : MonoBehaviour
{

private long WindowHandle = 0;
private long StatusBarHandle = 0;

void Start()
{
Plugin.Initialize();//Initializes Giavapps Windows API
WindowHandle = Window.Create(0, 100, 100, 400, 400, Constant.WS_VISIBLE | Constant.WS_SYSMENU | Constant.WS_MINIMIZEBOX | Constant.WS_MAXIMIZEBOX | Constant.WS_SIZEBOX, Constant.WS_EX_TOPMOST);//Creates a new window
Control.SetText(WindowHandle, "Giavapps Windows API");//Sets a new title for the specified window
StatusBarHandle = StatusBar.Create(WindowHandle, Constant.WS_VISIBLE | Constant.WS_CHILD, 0);//creates a new status bar
StatusBar.SetParts(StatusBarHandle, 4);//sets the number of parts in the status bar
StatusBar.SetPart(StatusBarHandle, 0, 100, 0, "Part 0");//sets the position, icon and text of the part
StatusBar.SetPart(StatusBarHandle, 1, 200, 0, "Part 1");//sets the position, icon and text of the part
StatusBar.SetPart(StatusBarHandle, 2, 300, 0, "Part 2");//sets the position, icon and text of the part
StatusBar.SetPart(StatusBarHandle, 3, –1, 0, "Part 3");//sets the position, icon and text of the part
}

void Update()
{

//Checks if the specified window has been closed
if(Window.GetClosed(WindowHandle))
{
Control.Destroy(WindowHandle);//Destroys the specified window
}

//Checks if the specified status bar has been clicked
if(StatusBar.GetClicked(StatusBarHandle, 0))
{
Debug.Log("STATUS BAR CLICKED!");
}

}

void OnApplicationQuit()
{
Plugin.Deinitialize();//Deinitializes Giavapps Windows API
}

}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Comments are closed.