BlitzUI question!

Community Forums/Showcase/BlitzUI question!

Insane Games(Posted 2003) [#1]
Hi Fuller, can you help me with this:
I need to set a text in a textbox multiline with the text taken from other textbox (single line).
Like a chat: write in a text input a message, press a button then the message appears in the textbox multiline, each line a message.

Thanks!

MB


Odds On(Posted 2003) [#2]
To get the text from the single-line textbox use:

txt$ = SendMessage( mytextbox, "TM_GETTEXT" )
To insert that value into a multi-line textbox use:

numlines = SendMessage( myothertextbox, "TM_GETCOUNT" )
SendMessage( myothertextbox, "TM_SETTEXT", numlines, txt$ )
Hope this helps :)


sswift(Posted 2003) [#3]
Fuller, why did you choose to use strings for all your message types? I would have used constants. If I'm not mistaken, Blitz has a limitation on the number of strings you can have, and in addition they will all appear in your EXE bloating it's size and making it easier to modify it. (though I am not the paranoid type that concerns myself with whether people can modify my game)

In addition, you have to transfer those strings to the functions every time you call an event, which if you call a function tousands of times for whatever reason, could cost you.

The only logical reason I can see to use strings is that it saves you the effort of defining all your constants.

One other additional benefit of using constants would be that if one uses a third party utility to have explicit variable declatartions, a mistyped constant would pop up an error whereas a mistyped string would not.


Odds On(Posted 2003) [#4]
sswift, the reason I chose to use strings was so that I didn't have to type out all the Constant declarations (as you said). I didn't realise it would slow it down or that there was a limitation on the number of strings.. any idea what the limit is?

Thanks for the tips :)


Michael Reitzenstein(Posted 2003) [#5]
String comparison is *extremely* slow.


sswift(Posted 2003) [#6]
I don't know what the limit is, but someone reposted it in the bug report forum I believe.

Reported that it was a problem I mean. I don't think anyone but Mark knows the actual specific limit, if there really is one.