Help Needed with LavishUI

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
linkmaster
GamingTools Subscriber
Posts: 39
Joined: Tue Jul 13, 2004 8:00 am

Help Needed with LavishUI

Post by linkmaster » Sat Nov 03, 2007 12:06 pm

I'm hoping someone can point out where I'm going wrong...

This is a test script to help me learn how to set up a GUI for my myprices script.

What it SHOULD do is open a 3 tab window , set the checkbox to ON and then react when it's ticked on and off.

What it's doing is opening the window , NOT ticking the checkbox and always reporting that the checkbox is un-ticked regardless..

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<ISUI>
	<template name='My.window.TitleBar'>
    		<Border>1</Border>
		<x>3</x>
    		<BorderColor>FF000033</BorderColor>
    		<Width>r6</Width>
		<Height>26</Height>
		<Texture Template='EQ2.window.TitleBar.Texture' />
		<Children>
			<Text Name='Title' template='EQ2.window.TitleBar.title' />
			<Button Name='Minimize' template='EQ2.window.TitleBar.Minimize'>
			</Button>
			<Button Name='Maximize' template='EQ2.window.TitleBar.Maximize'>
			</Button>
			<commandbutton name='Custom Close Button' Template='EQ2.Window.TitleBar.Close'>
				<Command>Script[myprices]&#58;End</Command>
			</commandbutton>
		</Children>
	</template>
	<template name='My.window'>
		<Border>1</Border>
		<Resizable>1</Resizable>
		<CloseButton />
		<MinimizeButton />
		<MaximizeButton />
		<TitleBar template='My.window.TitleBar' />
 		<OffsetTitleBarHeight />
		<Client template='EQ2.window.Client' />
		<StorePosition>1</StorePosition>
	</template>
	<!-- Main Window -->
	<Window Name='MyPrices' template='My.window'>
	<X>5%</X>
	<Y>20%</Y>
	<Width>430</Width>
	<Height>420</Height>
	<Client Template='EQ2.Window.Client'>
		<Y>20</Y>
	</Client>
	<StorePosition>1</StorePosition>
	<Title>MyPrices Broker system</Title>
	<TitleBar Template='EQ2.Window.TitleBar'>
		<X>0</X>
		<Y>0</Y>
		<Width>100%</Width>
		<Height>20</Height>
		<Children>
			<Text Name='Title' Template='EQ2.Window.TitleBar.Title' />
			<Button Name='Minimize' Template='EQ2.Window.TitleBar.Minimize'>
				<X>r35</X>
				<Width>14</Width>
				<Height>14</Height>
			</Button>
			<commandbutton name='Custom Close Button' Template='EQ2.Window.TitleBar.Close'>
				<X>r17</X>
				<Width>14</Width>
				<Height>14</Height>
				<Command>Script[myprices]&#58;End</Command>
			</commandbutton>
		</Children>
	</TitleBar>
	<Children>
		<Tabcontrol Name='GUITabs' Template='EQ2.Tabcontrol'>
			<X>1%</X>
			<Y>1%</Y>
			<Height>98%</Height>
			<Width>98%</Width>
				<Tabs>
					<Tab Name='Main'>
						<Text name='ConfigSell Text' Template='EQ2.text'>
							<X>5%</X>
							<Y>10</Y>
							<Width>80%</Width>
							<Height>20</Height>
							<Alignment>Left</Alignment>
							<Font>
								<Color>FFFFFFE5</Color>
							</Font>
							<Text>MyPrices Options&#58;</Text>
						</Text>
						<checkbox Name='MatchLowPrice' Template='EQ2.checkbox'>
							<X>5%</X>
							<Y>50</Y>
							<Width>20%</Width>
							<Height>20</Height>
							<Text>Auto-Match Lower Prices?</Text>
							<OnLoad>
								UIElement[MatchLowPrice@Main@GUITabs@MyPrices]&#58;SetChecked
							</OnLoad>
							<OnLeftClick>
								if $&#123;UIElement[MatchLowPrice@Main@GUITabs@MyPrices].Checked&#125;
								&#123;
									echo Set MatchLowPrices true
								&#125;
								else
								&#123;
									echo Set MatchLowPrices false
								&#125;
							</OnLeftClick>
						</checkbox>
						<checkbox Name='MatchHighPrice' Template='EQ2.checkbox'>
							<X>15%</X>
							<Y>50</Y>
							<Width>20%</Width>
							<Height>20</Height>
							<Text>Auto-Match Higher Prices?</Text>
							<OnLoad>
							UIElement[MatchHighPrice@Main@GUITabs@MyPrices]&#58;SetChecked
							</OnLoad>
							<OnLeftClick>
								if $&#123;UIElement[MatchHighPrice@Main@GUITabs@MyPrices].Checked&#125;
								&#123;
									echo Set MatchHighPrices true
								&#125;
								else
								&#123;
									echo Set MatchHighPrices false
								&#125;
							</OnLeftClick>
						</checkbox>
					</Tab>
					<Tab Name='Sell'>
					</Tab>
					<Tab Name='Buy'>
					</Tab>
				</Tabs>
		</Tabcontrol>
	</Children>
	</Window>
</ISUI>
Any help is gratefully recieved as I'm stuck updating myprices till I can get my head around this.

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Sun Nov 04, 2007 11:35 am

instead of referring to the current element via its FQN and the UIElement object, use This. e.g.

Code: Select all

This&#58;SetChecked
.
.
$&#123;This.Checked&#125;
Likewise, you can refer to the parent of the current with This.Parent, and so on.

That's my first instinct. Past that, I'd be curious if your skin/templates are working properly. The check state changes every time it's clicked, specifically when the left mouse button is released. It's possible if the skin/templates are not working properly that it's changing, and you're just not seeing it because the template is broken.

Post Reply