Re: setVisible on tab pages

new topic     » goto parent     » topic index » view thread      » older message » newer message

ZNorQ wrote:
> 
> I'm making a form containing tab pages, (lets call page one "general", and
> page 2 "Extras" for simplicity). On page "General" there is a field that
> will be hidden - or shown - depending on certain conditions. The thing is
> that when page "Extras" have focus, and the conditions for the field makes
> it visible - it shows up on the Extras tab! Anyone else experienced this, 
> and anyone know if this is being fixed - or can be remedied now?

The tab page is not a real control. The way it works is that when you select a
tab page, win32lib hides all the controls it knows are on the other tabs, then
makes visible all the controls it knows are on the tab you selected. If your
application plays with the visiblity outside of the normal process, you must also
take into consideration the tab page status.

In other words, one of the criteria for making a control visible should be that
its 'parent' tab page is the currently selected tab page.

Here is a function that may help. It returns 1 if the specified control is in
the currently selected TabItem.

function IsTabItemVisible(integer theTabControl, integer theControl)
  integer lIdx
  sequence lKids
  
  lIdx = sendMessage( theTabControl, TCM_GETCURSEL, 0, 0)
  if lIdx < 0 then
    -- None selected
    return 0
  end if
  lIdx += 1
  
  lKids = findChildren(theTabControl)
  if length(lKids) < lIdx then
    -- Should not happen.
    return 0
  end if
  lCurrentTab = lKids[lIdx][1]
  
  if findParent(theControl) != lCurrentTab then
      return 0
  end if
  return 1
end function

-- 
Derek Parnell
Melbourne, Australia
irc://irc.sorcery.net:9000/euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu