Limit Input in Textbox


This method changes a native LB textbox so that the user can only type a specified number of characters. It limits the amount of text the textbox can hold.

As documented in APIs for Liberty BASIC

nomainwin

nomainwin
textbox #1.t, 10,10,150,24
open "Limit Text" for window_nf as #1
print #1, "trapclose [quit]"

hText=hwnd(#1.t)    'handle

calldll #user32, "SendMessageA",_
hText as ulong,_        'textbox handle
_EM_LIMITTEXT as long,_ 'message to send
20 as long,_            'max characters
0 as long,_             'not used, must be 0
ret as long

print #1.t, "!setfocus"

wait

[quit]
close #1:end


Home

Source Code

Utilities

Internet

Games

Graphics

Media Demos

Snippets

DLL's

API Resources

Freeware

LB 4 Companion

Mastering LB 3

LB Workshop

Game Workshop

Links

Index