unable to enter any character at runtime

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Rohitmrrk
Posts: 2
Joined: Thu May 14, 2015 12:16 pm

unable to enter any character at runtime

Post by Rohitmrrk »

Hi... I'm very new in c++ and irrlicht too.
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 :wink:

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;
}
 
Please Help me :(
Last edited by Rohitmrrk on Mon Jul 06, 2015 8:57 am, edited 2 times in total.
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: unable to enter any character at runtime

Post by Cube_ »

Can't help you without seeing some source code, post the relevant part of the code that isn't working
I recommend you use code tags, they look like this:

Code: Select all

[code]
[/code]
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: unable to enter any character at runtime

Post by CuteAlien »

Preferably post the whole code so we can compile it.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Rohitmrrk
Posts: 2
Joined: Thu May 14, 2015 12:16 pm

Re: unable to enter any character at runtime

Post by Rohitmrrk »

CuteAlien wrote:Preferably post the whole code so we can compile it.
Sorry bro same code we have the examples from irrlicht SDK.
When I set some text in design time like

Code: Select all

MyEditBox.text="Hello World"
it displayed properly but when I run the apps and then enter some text it shows Spaces but not any characters.
Please help me. Thanks
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: unable to enter any character at runtime

Post by CuteAlien »

Which example?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply