realbasic-nug
[Top] [All Lists]

Re: Read Only

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Read Only
From: Norman Palardy <npalardy@great-white-software.com>
Date: Sat, 31 Jan 2009 02:00:12 -0700
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <49840951.9070104@blueyonder.co.uk>
References: <497DF6AE.3060703@blueyonder.co.uk> <DFF42BA3-3E0E-4842-A5CB-F1842E546F44@great-white-software.com> <49840951.9070104@blueyonder.co.uk>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com

On 31-Jan-09, at 1:18 AM, Trisha Duke wrote:

i did what you say... it work on the mac... wonderfully...BUT on the pc, the readonly for combobox doesn't work. it still allow to be dropdown and selected. what can do to stop that??

You might have to just check in the events keydown and mousedown as well on the PC and return the boolean to refuse to let the event continue
At least those would be where'd I'd be trying to intercept things
But I see that works on OS X but on Vista the popup properly refuses to pop down when marked read only but I can type anything into the text area of the combo box
And you dont get keydowns :(

So what I did to my subclass of combobox was

Private mReadOnly as boolean
Private mValueLocked As string


computed property readOnly As boolean
        Get
           return mReadonly
        Set
           mValueLocked = self.Text
           mReadonly = value

Event TextChanged()
  #if TargetWin32
    static inEvent as boolean

    if inEvent then return
    inEvent = true

    if me.readOnly then
      me.text = mValueLocked
    end if
    inEvent = false
  #endif
End Sub


Event KeyDown(Key As String) As Boolean
  if me.readOnly then return true
    return Keydown(key)
End Function


Event MouseDown(X As Integer, Y As Integer) As Boolean
  if me.readOnly then return true
  return MouseDown(x,y)


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>