Re: How to make TextBox read only but look normal
- Posted by Dan_M Jul 06, 2009
- 1338 views
lockiedownunder said...
Gday to all,
At the moment in my program, when a record is in display mode I set the TextBox's to setEnabled(TXTBox,False) but this makes everything grey & looks yuk.
How might I better display the fields and prevent people from changing the contents. But then enable the fields after clicking the edit button.
Using win32lib of course.
Thanks Tony
I thought the following would work, but it doesn't,
maybe someone can fix it or provide a different way that works?
-- code generated by Win32Lib IDE v1.0.4 Build July-06-2008 constant TheProgramType="exw" include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) constant StatusBar5 = createEx( StatusBar, "StatusBar5", Window1, 0, 0, 0, 0, 0, 0 ) constant EditText3 = create( EditText, "EditText3", Window1, 16, 56, 140, 20, ES_READONLY ) constant PushButton4 = createEx( PushButton, "Enable Edit", Window1, 40, 24, 88, 28, 0, 0 ) --------------------------------------------------------- -------------------------------------------------------------------------------- procedure PushButton4_onClick (integer self, integer event, sequence params)--params is () sequence lflags1, lflags2 lflags1 = getStyleFlags(EditText3) removeStyle(EditText3, ES_READONLY ) -- only important part, rest is debug lflags2 = getStyleFlags(EditText3) setText(StatusBar5, sprint(lflags1) & " " & sprint(lflags2) ) end procedure setHandler( PushButton4, w32HClick, routine_id("PushButton4_onClick")) --------------------------------------------------------- WinMain( Window1,Normal )