Thanks!

Steve Goodrich

Adam Ernst wrote:
On Feb 27, 2006, at 11:19 AM, Steve Goodrich wrote:

Is there an automated way to tell a REALbasic application to move focus to the next control on a form?

No, though I've faked it by using the following (non-foolproof) method:

Sub SendFocusTONextControl(Extends w as Window, FromControl as RectControl) dim mNext as Boolean // do send the focus to the next control in the order

  for lc as integer = 0 to w.ControlCount-1
    if mNext then
      if CanAcceptFocus(w.Control(lc)) then
        RectControl(w.Control(lc)).SetFocus
        return
      End If
    elseif w.Control(lc) is FromControl then
      mNext = true
    end if
  next
End Sub

Function CanAcceptFocus(c as Control)
  if not(c isa RectControl) then return false

  dim r as RectControl = RectControl(c)

  if r.Enabled = false then return false
  if r.Visible = false then return false
  if r.Parent <> nil and r.Parent isa PagePanel then
    if r.Parent.Index <> r.TabPanelIndex then return false
  end if

  if r isa PushButton then return true
  if r isa CheckBox then return true
  if r isa RadioButton then return true
  if r isa Listbox then return true
  if r isa PopupMenu then return true
  if r isa ComboBox then return true
  if r isa EditField then return True
  if r isa Slider then return true

  if r isa Canvas and Canvas(r).AcceptFocus then return true
if r isa DisclosureTriangle and DisclosureTriangle(r).AcceptFocus then return true
  if r isa BevelButton and BevelButton(r).AcceptFocus then return true
  if r isa ScrollBar and ScrollBar(r).AcceptFocus then return true
end if

Adam

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

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

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

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to