<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[GMan's Mods & Stuff — Using element IDs]]></title>
		<link>https://gprogs.com/viewtopic.php?id=114</link>
		<atom:link href="https://gprogs.com/extern.php?action=feed&amp;tid=114&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Using element IDs.]]></description>
		<lastBuildDate>Mon, 09 Oct 2006 22:35:49 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Using element IDs]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=502#p502</link>
			<description><![CDATA[<p>bah.&nbsp; i shouldve seen that.&nbsp; sorry <img src="https://gprogs.com/img/smilies/hmm.png" width="15" height="15" alt="hmm" />&nbsp; glad you got it!&nbsp; i reviewed the inner workings of the code for errors but didnt look at the parameters.&nbsp; look forward to seeing a project from you someday should you release something public <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Mon, 09 Oct 2006 22:35:49 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=502#p502</guid>
		</item>
		<item>
			<title><![CDATA[Re: Using element IDs]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=501#p501</link>
			<description><![CDATA[<p>Alright I think I found the problem.<br />When I was looking at the API I noticed an option in getElementfromID() to set child searching to true.<br />Now it returns values. Sweet.<br />Thanks for your help.</p>]]></description>
			<author><![CDATA[null@example.com (HondaDirtBiker)]]></author>
			<pubDate>Mon, 09 Oct 2006 17:42:41 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=501#p501</guid>
		</item>
		<item>
			<title><![CDATA[Re: Using element IDs]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=500#p500</link>
			<description><![CDATA[<p>Sorry I should have been more clear. I can&#039;t because I create the images and buttons with a loop.<br />But the Buttons and Scroll bar don&#039;t return any information.</p><p>This is just the idea of the code.<br /></p><div class="codebox"><pre><code>&#039;Create Inventory List In Inventory Window
Local IDs:Int = 1
Local Row:Int

For Row = 1 To 5
    Local Col:Int
    
    For Col = 1 To 4
        If (InventoryItems[InvTab.getActiveTab()].length =&gt; IDs)
            Gui.addImageFromTexture(..
                Video.getTexture(&quot;Media/InvItem.tga&quot;), ..
                _POSITION2DI(8 + ((Col - 1) * 64), 64 + 8 + ((Row - 1) * 64)), ..
                True, ..
                Inventory, ..
                703 + IDs, ..
                &quot;Background&quot;)
            Gui.addButton(..
                _RECTI(8 + ((Col - 1) * 64), 64 + 8 + ((Row - 1) * 64), 8 + ((Col - 1) * 64) + 64, 64 + 8 + ((Row - 1) * 64) + 64), ..
                Inventory, ..
                703 + 20 + IDs, ..
                InventoryItems[InvTab.getActiveTab()][IDs - 1]).setImage(video.getTexture(&quot;Media/InvImage.tga&quot;))
                
                IDs :+ 1
        Else
            Gui.addImageFromTexture(..
                Video.getTexture(&quot;Media/InvItem.tga&quot;), ..
                _POSITION2DI(8 + ((Col - 1) * 64), 64 + 8 + ((Row - 1) * 64)), ..
                True, ..
                Inventory, ..
                703 + IDs, ..
                &quot;Background&quot;)
            Gui.addButton(..
                _RECTI(8 + ((Col - 1) * 64), 64 + 8 + ((Row - 1) * 64), 8 + ((Col - 1) * 64) + 64, 64 + 8 + ((Row - 1) * 64) + 64), ..
                Inventory, ..
                703 + 20 + IDs, ..
                &quot;Empty&quot;).setVisible(False)
            
            IDs :+ 1
        End If
    Next
Next

&#039;Changed if Scrolled in Event Reciever
If (id = 702)
    Local InvButton:IGUIButton
    Local IDs:Int = 1
    Local Scrolled:Int = IGUIScrollBar.createFromHandle(event.getGUIEventCaller().handle, False).getPos()
    Local Row:Int
    Local I:Int
    
    For Row = 1 To 5
        Local Col:Int
        
        For Col = 1 To 4
            If (InventoryItems[0].length =&gt; IDs + Scrolled * 4)
                InvButton = IGUIButton.createFromHandle(Gui.getRootGUIElement().getElementFromId(703 + IDs).handle, False)
                InvButton.setVisible(True)
                InvButton.setImage(Video.getTexture(&quot;Media/EllipseInfo.tga&quot;))
                InvButton.setText(InventoryItems[0][IDs + Scrolled * 4 - 1])
                
                IDs :+ 1
            Else
                InvButton = IGUIButton.createFromHandle(Gui.getRootGUIElement().getElementFromId(703 + IDs).handle, False)
                InvButton.setVisible(False)
                InvButton.setImage(Video.getTexture(&quot;Media/InvItem.tga&quot;))
                InvButton.setText(&quot;Empty&quot;)
                
                IDs :+ 1
            End If
        Next
    Next
End If</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (HondaDirtBiker)]]></author>
			<pubDate>Mon, 09 Oct 2006 15:55:40 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=500#p500</guid>
		</item>
		<item>
			<title><![CDATA[Re: Using element IDs]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=499#p499</link>
			<description><![CDATA[<p>what happens if you use the return value from AddImageFromTexture to change the image?<br /></p><div class="codebox"><pre><code>&#039;Create
InvImage = Gui.addImageFromTexture(..
    Video.getTexture(&quot;Media/InvItem.tga&quot;), ..
    _POSITION2DI(8 + ((Col - 1) * 64), 64 + 8 + ((Row - 1) * 64)), ..
    True, ..
    Inventory, ..
    704, ..
    &quot;Empty&quot;)

&#039;Change
InvImage.setText(&quot;Used&quot;)
InvImage.setImage(Video.getTexture(&quot;Media/InvUsed.tga&quot;))</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Mon, 09 Oct 2006 11:58:39 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=499#p499</guid>
		</item>
		<item>
			<title><![CDATA[Re: Using element IDs]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=498#p498</link>
			<description><![CDATA[<p>I tried what you said but I am having a new problem.<br />When I try modifying the image elements from IDs they do not accept the changes. I&#039;ve tested the same code substituting buttons for images and it works correctly.<br />One thing I noticed is this happens only if the elements are children of another element.<br /></p><div class="codebox"><pre><code>&#039;Create
Gui.addImageFromTexture(..
    Video.getTexture(&quot;Media/InvItem.tga&quot;), ..
    _POSITION2DI(8 + ((Col - 1) * 64), 64 + 8 + ((Row - 1) * 64)), ..
    True, ..
    Inventory, ..
    704, ..
    &quot;Empty&quot;)

&#039;Change
InvImage = IGUIImage.createFromHandle(Gui.getRootGUIElement().getElementFromId(704).handle)
InvImage.setText(&quot;Used&quot;)
InvImage.setImage(Video.getTexture(&quot;Media/InvUsed.tga&quot;))</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (HondaDirtBiker)]]></author>
			<pubDate>Thu, 05 Oct 2006 14:20:18 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=498#p498</guid>
		</item>
		<item>
			<title><![CDATA[Re: Using element IDs]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=488#p488</link>
			<description><![CDATA[<p>i think i figured out what this is and it will actually be fixed in the next version.&nbsp; getElementFromId() currently returns an IGUIElement.&nbsp; you need to get the IGUIElement into the actual gui type before you can call the type-specific methods on it.&nbsp; in the next version of the mod, the return value from getElementFromId() will be the right type, you will just need to cast it.&nbsp; in the current version though, you will need to call the proper types createFromHandle function, passing in the returned IGUIElement handle.</p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Mon, 02 Oct 2006 20:01:24 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=488#p488</guid>
		</item>
		<item>
			<title><![CDATA[Re: Using element IDs]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=486#p486</link>
			<description><![CDATA[<p>greetings <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; which line provided is it erroring on?&nbsp; and could you paste the error message?</p><p>thx.</p>]]></description>
			<author><![CDATA[null@example.com (gman)]]></author>
			<pubDate>Mon, 02 Oct 2006 17:10:39 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=486#p486</guid>
		</item>
		<item>
			<title><![CDATA[Using element IDs]]></title>
			<link>https://gprogs.com/viewtopic.php?pid=484#p484</link>
			<description><![CDATA[<p>I need to use an ID to use commands with the gui elements. When I get an ID and try to use a command with it, bmax says the command does not exist.<br />I wanted to have a grid of images and change them as the scrollbar changes.<br />Here&#039;s my code.<br /></p><div class="codebox"><pre><code>&#039;Inventory Window
Local Inventory:IGUIWindow = Gui.addWindow(..
    _RECTI(100 + CNT, 100 + CNT, 400 + CNT, 532 + CNT), ..
    False, ..
    &quot;Inventory&quot;, Null, 700)

&#039;Inventory List
Local Row
For Row = 1 To 5
    Local Col
    For Col = 1 To 4
        If (InventoryArray[InvTab.getActiveTab()].length = Row + Col)
            Gui.addImageFromTexture(..
                Video.getTexture(&quot;Media/InvItem.tga&quot;), ..
                _POSITION2DI(8 + ((Col - 1) * 64), 64 + 8 + ((Row - 1) * 64)), ..
                True, ..
                Gui.getRootGUIElement().getElementFromId(700), ..
                703 + Row + Col, ..
                InventoryArray[InvTab.getActiveTab()][Row + Col])
        Else
            Gui.addImageFromTexture(..
                Video.getTexture(&quot;Media/InvItem.tga&quot;), ..
                _POSITION2DI(8 + ((Col - 1) * 64), 64 + 8 + ((Row - 1) * 64)), ..
                True, ..
                Gui.getRootGUIElement().getElementFromId(700), ..
                703 + Row + Col, ..
                &quot;Empty&quot;)
        End If
    Next
Next
&#039;Iventory Scroll Bar
Local InvScroll:IGUIScrollBar = Gui.addScrollBar(False, _RECTI(272, 16 + 64, 292, 360), Inventory, 702)

&#039;Scrolling
If (id = 702 and Gui.getRootGUIElement().getElementFromId(700).isValid() = True)
    Local Row
    For Row = 1 To 5
        Local Col
        For Col = 1 To 4
            Local InvItem:IGUIElement = InvItem = Gui.getRootGUIElement().getElementFromId(703 + Row + Col)
            If (0 = Row + Col)
                InvItem.setText(&quot;Used&quot;)
                InvItem.setImage(&quot;Media/EllipseInfo.tga&quot;)
            Else
                InvItem.setText(&quot;Empty&quot;)
                InvItem.setImage(&quot;Media/InvItem.tga&quot;)
            End If
        Next
    Next
End If</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (HondaDirtBiker)]]></author>
			<pubDate>Mon, 02 Oct 2006 14:00:47 +0000</pubDate>
			<guid>https://gprogs.com/viewtopic.php?pid=484#p484</guid>
		</item>
	</channel>
</rss>
