1manik 0 Newbie Poster

Hi, I want to ask you, how can I do that this program will be finished by pressing of enter? Please help me. I tried it and it is writted in this program, but no effect. THANKS

#include "SDL/GUI.h"
#include <stdio.h>
#include <windows.h>

int main(int argc, char* args[])
{
bool quit = false;      

//This code will make a window with 256 x 192 size, window initialisation

if(init(256, 192,"Dev Window") == false)
{
return 1;
}



Label inputLbl(30, 20, "Input :");
TextBox txtInput (140, 20, 100, 26, "");
Label outputLbl(30, 60, "Output :");
Label resultLbl(140, 60, "");
Button showBtn (140, 100, 100, 26, 170, 101, "Show");
Button quitBtn (140, 140, 100, 26, 173, 141, "Quit");

//This is main loop for SDL program

while(!quit)
{
clearWindow();                        
if(SDL_PollEvent(&event))  
{
showBtn.handle_events();             
quitBtn.handle_events();
txtInput.handle_events();

if(showBtn.isClicked())            
{
resultLbl.setText(txtInput.getText());
}

SDL_Event keyevent;    .
 
while (SDL_PollEvent(&keyevent))   
{
  if (keyevent.type == SDLK_PK_ENTER)
  {
  quit = true;
  }
}
}
if (event.type == SDL_QUIT) 
{
quit = true;
}
}
inputLbl.show();
outputLbl.show();
resultLbl.show();
txtInput.show();
showBtn.show();
quitBtn.show();

if(SDL_Flip(screen) == -1)      
{
return 1;
}
}

clean_up();   
return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.