thucanh
10-07-2008 06:26:02
Hello,
Iin my Viewer, I need some "ImageButton" control. After reading the "MyGUI skin creating" in Wiki and looking at LayoutEditor's editor.skin, I created myown skin by:
- create a icons.png image contains all my icons to be used as image on buttons
- create my.skin by copy ButtonMinimize from editor.skin.
- add my.skin to editor.xml so that it'll be loaded in.
- create my.layout using LayoutEditor
But I had some problems as folow:
1. Only the first icon located on the left edge of png image is displayed, other icons was not.
2. When I run in debug mode, I get error related to XML loading at line widgets = LayoutManager::getInstance().load("my.layout");
Error message from output:
I think the skins I was the cause of problem no. 2, but can not figure out what it is.
Here is my.skin:
BTW, I have an warning in MyGUI.log about the icon.png size is not power of two, may it be the cause for no. 1? I will try to resize the png file right now to see if it work ...
Another question: How can I highlight a button after user clicked it? I tried to use btn->setButtonPressed(true) and btn->setState("selected") but no effect ...
thucanh
Iin my Viewer, I need some "ImageButton" control. After reading the "MyGUI skin creating" in Wiki and looking at LayoutEditor's editor.skin, I created myown skin by:
- create a icons.png image contains all my icons to be used as image on buttons
- create my.skin by copy ButtonMinimize from editor.skin.
- add my.skin to editor.xml so that it'll be loaded in.
- create my.layout using LayoutEditor
But I had some problems as folow:
1. Only the first icon located on the left edge of png image is displayed, other icons was not.
2. When I run in debug mode, I get error related to XML loading at line widgets = LayoutManager::getInstance().load("my.layout");
Error message from output:
HEAP[MyViewer.exe]: Invalid Address specified to RtlValidateHeap( 018B0000, 058FA578 )
Windows has triggered a breakpoint in MyViewer.exe.
This may be due to a corruption of the heap, and indicates a bug in MyViewer.exe or any of the DLLs it has loaded.
I think the skins I was the cause of problem no. 2, but can not figure out what it is.
Here is my.skin:
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Skin">
<Skin name = "Viewer_SpinIcon" size = "34 34" texture = "ToolIcons.png">
<BasisSkin type="MainSkin" offset = "0 0 34 34" align = "ALIGN_STRETCH">
<State name="disable" offset = 0 0 34 34"/>
<State name="active" offset = "0 37 34 34"/>
<State name="select" offset = "0 37 34 34"/>
<State name="normal" offset = "0 0 34 34"/>
<State name="pressed" offset = "0 0 34 34"/>
</BasisSkin>
</Skin>
<Skin name = "Viewer_RotateIcon" size = "34 34" texture = "ToolIcons.png">
<BasisSkin type="MainSkin" offset = "37 0 34 34" align = "ALIGN_STRETCH">
<State name="disable" offset = 37 0 34 34"/>
<State name="active" offset = "37 37 34 34"/>
<State name="select" offset = "37 37 34 34"/>
<State name="normal" offset = "37 0 34 34"/>
<State name="pressed" offset = "37 0 34 34"/>
</BasisSkin>
</Skin>
<Skin name = "Viewer_MoveIcon" size = "34 34" texture = "ToolIcons.png">
<BasisSkin type="MainSkin" offset = "75 0 34 34" align = "ALIGN_STRETCH">
<State name="disable" offset = 75 0 34 34"/>
<State name="active" offset = "75 37 34 34"/>
<State name="select" offset = "75 37 34 34"/>
<State name="normal" offset = "75 0 34 34"/>
<State name="pressed" offset = "75 0 34 34"/>
</BasisSkin>
</Skin>
</MyGUI>
BTW, I have an warning in MyGUI.log about the icon.png size is not power of two, may it be the cause for no. 1? I will try to resize the png file right now to see if it work ...
Another question: How can I highlight a button after user clicked it? I tried to use btn->setButtonPressed(true) and btn->setState("selected") but no effect ...
thucanh