While I set text to the editbox at design time, after run the apps it displaying but I'm entering any character his doesn't appears.
What will I do.
And very sorry for my handicapped englishenglish
VB.Net (IrrlichtLime) Code:
Code: Select all
Imports IrrlichtLime
Imports IrrlichtLime.IO
Imports IrrlichtLime.GUI
Imports IrrlichtLime.Core
Imports IrrlichtLime.Video
Imports IrrlichtLime.Scene
Module Module1
Private WithEvents Device As IrrlichtDevice
Private Driver As VideoDriver
Private Environment As GUIEnvironment
Private MyEditBox As GUIEditBox
Private MyButton1 As GUIButton
Private MyButton2 As GUIButton
Sub Main()
Device = IrrlichtDevice.CreateDevice()
If Device Is Nothing Then Return
Driver = Device.VideoDriver
Environment = Device.GUIEnvironment
MyEditBox = Environment.AddEditBox("This is default Text", New Recti(40, 100, 200, 130), False)
MyButton1 = Environment.AddButton(New Recti(210, 100, 310, 130), Nothing, -1, "Show EditBox Text")
MyButton2 = Environment.AddButton(New Recti(320, 100, 420, 130), Nothing, -1, "Text at RunTime")
While Device.Run
Driver.BeginScene()
Environment.DrawAll()
Driver.EndScene()
End While
Device.Drop()
Return
End Sub
Public Function OnEvent(e As [Event]) As Boolean Handles Device.OnEvent
If e.Type = EventType.GUI Then
Select Case e.GUI.Type
Case GUIEventType.ButtonClicked
If e.GUI.Caller = MyButton1 Then MsgBox(MyEditBox.Text)
If e.GUI.Caller = MyButton2 Then MyEditBox.Text = "This text assigned at runtime"
End Select
End If
Return False
End Function
End Module
C++ Code for your convenience :
Code: Select all
#include "irrlicht.h"
using namespace irr;
using namespace io;
using namespace gui;
using namespace core;
using namespace scene;
using namespace video;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
class MyGUIClass : public IEventReceiver
{
public:
MyGUIClass(){};
~MyGUIClass(){};
void Run()
{
Device = createDevice(E_DRIVER_TYPE::EDT_DIRECT3D9, dimension2du(800,600), 32,false,false,false,this);
if (!Device) return;
Driver = Device->getVideoDriver();
Env = Device->getGUIEnvironment();
MyEditBox = Env->addEditBox(L"This is Default Text!", recti(100,100,250,130));
MyButton = Env->addButton(recti(260,100,360,130), 0, -1, L"Text at Runtime");
while (Device->run())
{
Driver->beginScene();
Env->drawAll();
Driver->endScene();
}
Device->closeDevice();
Device->drop();
return;
}
virtual bool OnEvent(const SEvent& event)
{
if (event.EventType == EET_GUI_EVENT)
{
if (event.GUIEvent.EventType==EGET_BUTTON_CLICKED && event.GUIEvent.Caller == MyButton)
{
MyEditBox->setText(L"This Text assigned at Runtime!");
}
}
return false;
}
private:
IrrlichtDevice* Device;
IVideoDriver* Driver;
IGUIEnvironment* Env;
IGUIEditBox* MyEditBox;
IGUIButton* MyButton;
};
void main()
{
MyGUIClass Apps;
Apps.Run();
return;
}