Home   Archive   Permalink



RebGUI - How to Display a long wrapping text field as Read-Only?

I want to display all fields for a record on a form for editing, but I want some of the fields to be uneditable. I thought about just displaying them using the TEXT widget, but these fields could contain long comments that need to wrap. I would like to have something like the AREA widget, but prevent the user from modifying the contents. Thank you for any suggestions.

posted by:   JackKort     21-Feb-2018/18:11:16-8:00



Info fieĺd maybe. Think it wraps. http://www.rebol.com/how-to/fields.html#section-6

posted by:   Rick     21-Feb-2018/21:56:49-8:00



The default wrap property of the text widget is true:
    
    ? ctx-rebgui/widgets/text/para
    
So this will wrap by default:
    
    x: copy clipboard://
    display "" [a: text x 100x100] do-events
    
If you want to display lots of scrollable text, it may simplest to use an area widget, and do a little hack like this to keep it from being editable:
    
display "" [
    a: area x on-edit [a/text: copy x show a]
]
    
Or if you want to go deeper, you could adjust the feel functions:
    
    probe get in ctx-rebgui/widgets/area/feel 'engage

posted by:   Nick     22-Feb-2018/0:12:08-8:00



And, BTW, you can use any VID style in RebGUI, like this:
    
    display "" [style 100x100 data [info x]] do-events
    
That displays a normal 'info widget from the built-in VID dialect.

posted by:   Nick     22-Feb-2018/0:19:13-8:00



Hello Nick,
I realize now my text wouldn't wrap b/c I didn't specify a size. I must be doing something wrong in trying to put a VID info in the middle of my form, as nothing was displaying, but your AREA hack works so well I'm going to run with it!
    
Thanks yet again for your help!

posted by:   JackKort     22-Feb-2018/10:38:57-8:00