Textfield not writeable

BlitzMax Forums/BlitzMax Beginners Area/Textfield not writeable

Heliotrope(Posted 2015) [#1]
Hi there, I am not sure what is wrong with the code but I can't input text into the textfield. The docs for textfields where of no help as when I copyed and ran them the same problem came up.




Floyd(Posted 2015) [#2]
First, how to use the docs.

With your code loaded into the IDE put the cursor on a relevant function, such as CreateTextField.

Tap F1 to show minimal help. In the status bar at the bottom of the screen you will see the function and arguments.

Tap F1 again to go to the relevant manual page, with a description of the function. This may not be very meaningful unless you already have an idea of how the entire module works. Drag the scroll bar up to the top of the page to see an overview.

Here is your example with one extra line of code near the end.

Import MaxGui.Drivers
Strict

SetGraphicsDriver GLGraphicsDriver()
Local window:TGadget
Local textfield:TGadget
Local button:TGadget
Local maintimer:TTimer

window=CreateWindow("",100,100,640,480,Null,WINDOW_DEFAULT|WINDOW_CLIENTCOORDS)
textfield=CreateTextField(5,GadgetHeight(window) - 25,520,22,window)
button=CreateButton("OK",531,GadgetHeight(window) - 25,80,24,window,BUTTON_OK)
maintimer = CreateTimer (60,Null)

ActivateGadget textfield

Repeat 

	If PollEvent () <> 0
		If EventID () = EVENT_WINDOWCLOSE Then Exit 
	EndIf 
	
	WaitTimer (maintimer)
		
Forever 

Print " Textfield contains " + GadgetText( textfield )


EndGraphics()
End 



Heliotrope(Posted 2015) [#3]
Hi Floyd, the code with the extra line still doesn't work. The problem is that the app is not accepting keyboard input and just makes a 'Din' error sound on the speakers every time a key is pressed even while the textfield is highlighted. Also over the years I have noticed a few small errors in the docs that have large effects on the function of the code such as missing brackets.

Nothing against the Blitz team though.


Floyd(Posted 2015) [#4]
That's a mystery. The code was always accepting input here. I thought maybe you just weren't seeing any results at the end, nothing displayed.

Do you see the cursor in the text field? I do as soon as the program runs.

I can get the ding sound by selecting a desktop icon while the program is running. After that text input fails. But as soon as I click on the text field the cursor is back and input works normally.

This is with BlitzMax 1.50 and 64-bit Windows 7.


Heliotrope(Posted 2015) [#5]
Just did a reinstall and it is fixed now. Not sure what was wrong.

But thanks for your help anyway.


col(Posted 2015) [#6]
Hiya,

Just a thought as I've done this many many times myself...
( I'm not suggesting that you've actually done this or it was the cause of your problem )

Although doing a re-install is simple enough and relatively quick, sometimes this can be a chore, especially when/if you have custom modules installed and you don't want to faff about saving and copying them around etc.

A possible cause is...
What can sometimes happen when you look through modules is that you accidentally hit the compile button while viewing module code. This would try to build the currently viewed module as your main application and sometimes it actually compiles!

The solution...
Either way, if it compiles or not, that module will need to be re-built via 'build modules' ( if it didn't compile ) or even 'rebuild all modules' ( if it did compile then the build system won't detect the incorrect successful compilation so you need to force it to be rebuilt ). You could go into the suspected module folder and delete the offending '.bmx folder', '.i' and '.a' files then do a 'build modules'. The build system will then rebuild that and any associated modules.

The whole point being that you need to get the build system in a working 'as designed' state again. If you don't do that then you'll usually get strange compilation errors, or even worse, your app actually compiles, runs and behaves strangely.

You will need a gcc compiler setup on your machine to compile the modules though. If you haven't got a clue what this means/entails then I digress that its probably better for you to do the re-install :o)