FireTextBox and ReadOnly property

Started by Jean-pierre Leroy, February 01, 2010, 05:46:47 PM

Previous topic - Next topic

Jean-pierre Leroy

Hi Paul,

I would like to set some FireTextBox "ReadOnly".

I set the property to true, but it doesn't change anything; the control still accept input ?

Is there a workaround to make a FireTextBox "ReadOnly".

Thanks,
Jean-Pierre

Roger Garstang

#1
Quickly skimming through it looks like it sets a variable ed.ReadOnly that never is checked for.  %ES_ReadOnly is checked but never set.  The disconnect there could be the issue. Could try setting the style %ES_ReadOnly on it yourself until fixed, but if the textbox portion is a child control it may not work.

Roger Garstang

Tried: SetWindowLong(HWND_FORM1_FIRETEXTBOX1, %GWL_STYLE, (GetWindowLong(HWND_FORM1_FIRETEXTBOX1, %GWL_STYLE) Or %ES_ReadOnly))

But, didn't work...I may have mistyped something though, I just tossed it together.  Winspector Spy shows the whole thing as an Edit control, so not sure why it didn't work.  And, boy does FF's copy protection not like Winspector...won't even compile with it open.

Jean-pierre Leroy

Thank you Roger,

I will make a try.

Regards,
Jean-Pierre

Roger Garstang

SendMessage(HWND_FORM1_FIRETEXTBOX1, %EM_SETREADONLY, 1, 0)

Worked!  But, you will have to use the other code Paul posted earlier for changing the color of a disabled textbox.

Paul Squires

Quote from: Roger Garstang on February 01, 2010, 06:31:03 PM
And, boy does FF's copy protection not like Winspector...won't even compile with it open.

FF3 does not use Armadillo like FF2 did so it is not a FF copy protection issue. Could be that Winspector does not like FF's subclassed controls.
Paul Squires
PlanetSquires Software

Paul Squires

Paul Squires
PlanetSquires Software

Roger Garstang

Quote from: TechSupport on February 01, 2010, 07:08:49 PM
FF3 does not use Armadillo like FF2 did so it is not a FF copy protection issue. Could be that Winspector does not like FF's subclassed controls.

Oh yeah, I forgot all about you changing that.  Must be the FireText being subclassed itself and subclassed again by FF or something.  I thought I had Winspector opened before with FF running, so that is the only thing different.

Paul Squires

Now fixed. Just needed to add the SendMessage to the code below:

         Case %FIRETEXTBOX_SETREADONLY
            @ed.ReadOnly = IIf&( wParam <> 0, 1, 0 )
            SendMessage @ed.hEdit, %EM_SETREADONLY, @ed.ReadOnly, 0

Set it as read-only:
   SendMessage HWND_FORM1_FIRETEXTBOX1, %FIRETEXTBOX_SETREADONLY, %TRUE, 0

Remove the read-only:
   SendMessage HWND_FORM1_FIRETEXTBOX1, %FIRETEXTBOX_SETREADONLY, %FALSE, 0
Paul Squires
PlanetSquires Software

Roger Garstang

So, is ed.ReadOnly for future use?  Like with a call to get current state or something...since that is the only place it gets used. Probably could save some CPU cycles checking it instead of getting the style where es_readonly is checked for too.