1. setVisible on tab pages

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?

Kenneth aka ZNorQ

new topic     » topic index » view message » categorize

2. Re: setVisible on tab pages

> I'm making a form containing tab pages, (lets call page one "general", an=
d
> 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 make=
s
> 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?

What are you using as the parent for the controls, the tab control, or
the tab items? Don't use the tab control or the controls will be
visible on all tab items.

~Greg

new topic     » goto parent     » topic index » view message » categorize

3. Re: setVisible on tab pages

Greg Haberek wrote:
> 
> > I'm making a form containing tab pages, (lets call page one "general", an=
> d
> > 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 make=
> s
> > 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?
> 
> What are you using as the parent for the controls, the tab control, or
> the tab items? Don't use the tab control or the controls will be
> visible on all tab items.
> 
> ~Greg
> 
> 

Nope, I've created a tab control, containing two tab items. The field is
"tied" down to the tab items - and not the tab control.

Kenneth / ZNorQ

new topic     » goto parent     » topic index » view message » categorize

4. Re: setVisible on tab pages

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 message » categorize

5. Re: setVisible on tab pages

------=_Part_1175_17430434.1114670978482
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Have you set the parents of the fields correctly?


On 4/27/05, ZNorQ <guest at rapideuphoria.com> wrote:
>
>
> posted by: ZNorQ <znorq at holhaug.com <http://holhaug.com>>
>
> I'm making a form containing tab pages, (lets call page one "general", an=
d
> 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 make=
s
> 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?
>
> Kenneth aka ZNorQ
>
>
>
>
>


--
Regards
Tony Steward
www.locksdownunder.com <http://www.locksdownunder.com>

IF IT IS TO BE IT IS UP TO ME!

new topic     » goto parent     » topic index » view message » categorize

6. Re: setVisible on tab pages

On Thu, 28 Apr 2005 04:05:19 -0700, ZNorQ <guest at RapidEuphoria.com>
wrote:

I think you need additional tests around the setVisible call:
include win32lib.ew
constant main=create(Window,"Title",0,410,0,400,350,0)
constant
TabControl56=create(TabControl,"TabControl",main,32,30,200,283,0)
constant TabItem57=create(TabItem,"TabItem",TabControl56,0,0,0,0,0)
constant TabItem58=create(TabItem,"TabItem",TabControl56,0,0,0,0,0)
constant Label58=create(Label,"Label",TabItem57,26,44,169,20,0)
constant Button59=create(Button,"Button",main,277,69,75,30,0)
procedure bh(integer self, integer event, sequence params)
	if self or event or sequence(params) then end if
	if getTabItem(TabControl56)=TabItem57 then
		setVisible(Label58,not isVisible(Label58))
	end if
end procedure
setHandler(Button59,w32HClick,routine_id("bh"))
WinMain(main,Normal)


Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

7. Re: setVisible on tab pages

> Date: Thu, 28 Apr 2005 14:45:02 +0100
> From: Pete Lomax <petelomax at blueyonder.co.uk>
> Subject: Re: setVisible on tab pages
> 
> 
> On Thu, 28 Apr 2005 04:05:19 -0700, ZNorQ <guest at RapidEuphoria.com>
> wrote:
> 
> I think you need additional tests around the setVisible call:
> }}}
<eucode>
> include win32lib.ew
> constant main=create(Window,"Title",0,410,0,400,350,0)
> constant
> TabControl56=create(TabControl,"TabControl",main,32,30,200,283,0)
> constant TabItem57=create(TabItem,"TabItem",TabControl56,0,0,0,0,0)
> constant TabItem58=create(TabItem,"TabItem",TabControl56,0,0,0,0,0)
> constant Label58=create(Label,"Label",TabItem57,26,44,169,20,0)
> constant Button59=create(Button,"Button",main,277,69,75,30,0)
> procedure bh(integer self, integer event, sequence params)
> if self or event or sequence(params) then end if
> if getTabItem(TabControl56)=TabItem57 then
> setVisible(Label58,not isVisible(Label58))
> end if
> end procedure
> setHandler(Button59,w32HClick,routine_id("bh"))
> WinMain(main,Normal)
> </eucode>
{{{

> 
> Regards,
> Pete
> 

Which is why, in my forked VisualEuphoria, I replaced visibility status 
switches by resizing
to 1x1 and back to default for controls on tab items whose visibility may vary.
Derek, I didn't look into the showControlSet() code to understand how it 
interferes with setVisible(), but... do you think win32lib could handle that 
issue transparently?

CChris

new topic     » goto parent     » topic index » view message » categorize

8. Re: setVisible on tab pages

On 29 Apr 2005 11:29:54 +0200, Christian Cuvier
<Christian.CUVIER at agriculture.gouv.fr> wrote:

>> Date: Thu, 28 Apr 2005 14:45:02 +0100
>> From: Pete Lomax <petelomax at blueyonder.co.uk>
>> Subject: Re: setVisible on tab pages
>> 
>> I think you need additional tests around the setVisible call:
>> }}}
<eucode>
>> include win32lib.ew
>> constant main=create(Window,"Title",0,410,0,400,350,0)
>> constant
>> TabControl56=create(TabControl,"TabControl",main,32,30,200,283,0)
>> constant TabItem57=create(TabItem,"TabItem",TabControl56,0,0,0,0,0)
>> constant TabItem58=create(TabItem,"TabItem",TabControl56,0,0,0,0,0)
>> constant Label58=create(Label,"Label",TabItem57,26,44,169,20,0)
>> constant Button59=create(Button,"Button",main,277,69,75,30,0)
>> procedure bh(integer self, integer event, sequence params)
>> if self or event or sequence(params) then end if
>> if getTabItem(TabControl56)=TabItem57 then
>> setVisible(Label58,not isVisible(Label58))
>> end if
>> end procedure
>> setHandler(Button59,w32HClick,routine_id("bh"))
>> WinMain(main,Normal)
>> </eucode>
{{{

>> 
>> Regards,
>> Pete
>> 
>
>Which is why, in my forked VisualEuphoria, I replaced visibility status 
<snip>
What is which? Are you talking to me? blink)
What is difficult about wrapping the setVisible call with if
getTabItem(TabControl)=TheRightTabItem? Does the above not work?

Confused,
Pete

new topic     » goto parent     » topic index » view message » categorize

9. Re: setVisible on tab pages

Christian Cuvier wrote:


> Derek, I didn't look into the showControlSet() code to understand how it 
> interferes with setVisible(), but... do you think win32lib could handle that 
> issue transparently?

Yes. I'll work out something.

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

new topic     » goto parent     » topic index » view message » categorize

10. Re: setVisible on tab pages

>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.
>
>}}}
<eucode>
> 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
></eucode>
{{{

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

Derek, 

Hmm, makes it abit more complicated. I'll just have to implemend that
function (if you don't mind?), and combine it with a setHandler that
activates when the "General" page is clicked on ..

Thanks for the help, Derek.

Kenneth / ZNorQ.

new topic     » goto parent     » topic index » view message » categorize

11. Re: setVisible on tab pages

Pete Lomax wrote:
> 
> On Thu, 28 Apr 2005 04:05:19 -0700, ZNorQ <guest at RapidEuphoria.com>
> wrote:
> 
> I think you need additional tests around the setVisible call:
> }}}
<eucode>
> include win32lib.ew
> constant main=create(Window,"Title",0,410,0,400,350,0)
> constant
> TabControl56=create(TabControl,"TabControl",main,32,30,200,283,0)
> constant TabItem57=create(TabItem,"TabItem",TabControl56,0,0,0,0,0)
> constant TabItem58=create(TabItem,"TabItem",TabControl56,0,0,0,0,0)
> constant Label58=create(Label,"Label",TabItem57,26,44,169,20,0)
> constant Button59=create(Button,"Button",main,277,69,75,30,0)
> procedure bh(integer self, integer event, sequence params)
> 	if self or event or sequence(params) then end if
> 	if getTabItem(TabControl56)=TabItem57 then
> 		setVisible(Label58,not isVisible(Label58))
> 	end if
> end procedure
> setHandler(Button59,w32HClick,routine_id("bh"))
> WinMain(main,Normal)
> </eucode>
{{{

> 
> Regards,
> Pete
> 
> 


Pete,

First you really gotta explain the - 

 
if self or event or sequence(params) then end if


What would this accomplish? As I understand it, procedure "bh" will only
be executed when the button is clicked, alas there WILL be contents in
atleast two of those variables (self and event) - and probably params too?
Since there is nothing to be executed between "then" and "end if", I really
don't get it - and even if there where code between "then" and "end if",
it would still be executed every time, am I wrong? Please enlighten me! :D

Anyway, I don't think your code would be sufficient, as we gotta consider
two criterias here - either is the "general" tab in focus - or not. If it 
is, I could use Derek's code to test this when the right conditions for the
field to be visible is met. But if the "general" tab isn't in focus, I'd
have to wait till it is.. The control I'm using to verify the conditions of
the field is a set of radio buttons (as childs of a group - which again is
a child of the form itself..) ONE of those radio buttons shows the field,
the rest hides it. So, if I press the radio button that hides it, but the
tab page isn't active - how would I go about showing it when the page is
activated (got focus) at a later stage? 

I guess I'd have to combine it with a setHandler that activates when the user 
clicks the "general" tab too? Maybe throw in a variable that is either TRUE 
or FALSE - depending on if the field is supposed to be shown or not?

Don't know if I'm way off here, but thanks for the replies anyway.

Kenneth / ZNorQ

new topic     » goto parent     » topic index » view message » categorize

12. Re: setVisible on tab pages

ZNorQ wrote:
> 
> Pete Lomax wrote:
> > 
> > On Thu, 28 Apr 2005 04:05:19 -0700, ZNorQ <guest at RapidEuphoria.com>
> > wrote:
> > 
> > I think you need additional tests around the setVisible call:
> > }}}
<eucode>
> > include win32lib.ew
> > constant main=create(Window,"Title",0,410,0,400,350,0)
> > constant
> > TabControl56=create(TabControl,"TabControl",main,32,30,200,283,0)
> > constant TabItem57=create(TabItem,"TabItem",TabControl56,0,0,0,0,0)
> > constant TabItem58=create(TabItem,"TabItem",TabControl56,0,0,0,0,0)
> > constant Label58=create(Label,"Label",TabItem57,26,44,169,20,0)
> > constant Button59=create(Button,"Button",main,277,69,75,30,0)
> > procedure bh(integer self, integer event, sequence params)
> > 	if self or event or sequence(params) then end if
> > 	if getTabItem(TabControl56)=TabItem57 then
> > 		setVisible(Label58,not isVisible(Label58))
> > 	end if
> > end procedure
> > setHandler(Button59,w32HClick,routine_id("bh"))
> > WinMain(main,Normal)
> > </eucode>
{{{

> > 
> > Regards,
> > Pete
> > 
> > 
> Pete,
> 
> First you really gotta explain the - 
> 
>   }}}
<eucode>if self or event or sequence(params) then end if</eucode>
{{{


Looks like somthing to eliminate warnings, it is probably better to
use }}}
<eucode>without warning</eucode>
{{{
.

> <font color="#330033"></font>
> <font color="#330033">What would this accomplish? As I understand it,
> </font><font color="#0000FF">procedure </font><font color="#00A033">"bh"
> </font><font color="#330033">will only</font>
> <font color="#330033">be executed when the button is clicked, alas there WILL
> be contents in</font>
> <font color="#330033">atleast two of those variables (self </font><font
> color="#0000FF">and </font><font color="#330033">event) - </font><font
> color="#0000FF">and </font><font color="#330033">probably params too?</font>
> <font color="#330033">Since there is nothing </font><font color="#0000FF">to
> </font><font color="#330033">be executed between </font><font
> color="#00A033">"then" </font><font color="#0000FF">and </font><font
> color="#00A033">"end if"</font><font color="#330033">, I really</font>
> <font color="#330033">don</font><font color="#00A033">'t get it - and even if
> there where code between "then" and "end if",</font>
> <font color="#330033">it would still be executed every </font><font
> color="#FF00FF">time</font><font color="#330033">, am I wrong? Please enlighten
> me! :D</font>
> <font color="#330033"></font>
> <font color="#330033">Anyway, I don</font><font color="#00A033">'t think your
> code would be sufficient, as we gotta consider</font>
> <font color="#330033">two criterias here - either is the </font><font
> color="#00A033">"general" </font><font color="#330033">tab in focus -
> </font><font color="#0000FF">or not</font><font color="#330033">. If it </font>
> <font color="#330033">is, I could use Derek</font><font color="#00A033">'s
> code to test this when the right conditions for the field to be visible is met.
> But if the "general" tab isn'</font><font color="#330033">t in focus,
> I</font><font color="#00A033">'d</font>
> <font color="#330033">have </font><font color="#0000FF">to </font><font
> color="#330033">wait till it is.. The control I</font><font color="#00A033">'m
> using to verify the conditions of</font>
> <font color="#330033">the field is a set of radio buttons (as childs of a
> group - which again is</font>
> <font color="#330033">a child of the form itself..) ONE of those radio buttons
> shows the field,</font>
> <font color="#330033">the rest hides it. So, </font><font color="#0000FF">if
> </font><font color="#330033">I press the radio button that hides it, but
> the</font>
> <font color="#330033">tab page isn</font><font color="#00A033">'t active - how
> would I go about showing it when the page is</font>
> <font color="#330033">activated (got focus) at a later stage? </font>
> <font color="#330033"></font>
> <font color="#330033">I guess I</font><font color="#00A033">'d have to combine
> it with a setHandler that activates when the user </font>
> <font color="#330033">clicks the </font><font color="#00A033">"general"
> </font><font color="#330033">tab too? Maybe throw in a variable that is either
> TRUE </font>
> <font color="#0000FF">or </font><font color="#330033">FALSE - depending on
> </font><font color="#0000FF">if </font><font color="#330033">the field is
> supposed </font><font color="#0000FF">to </font><font color="#330033">be shown
> </font><font color="#0000FF">or not</font><font color="#330033">?</font>
> <font color="#330033"></font>
> <font color="#330033">Don</font><font color="#00A033">'t know if
> I'</font><font color="#330033">m way off here, but thanks </font><font
> color="#0000FF">for </font><font color="#330033">the replies anyway.</font>
> <font color="#330033"></font>
> <font color="#330033">Kenneth / ZNorQ</font>
> <font color="#330033"></font>

new topic     » goto parent     » topic index » view message » categorize

13. Re: setVisible on tab pages

On Sat, 07 May 2005 08:26:09 -0700, ZNorQ <guest at RapidEuphoria.com>
wrote:

>First you really gotta explain the - 
>
>  }}}
<eucode>if self or event or sequence(params) then end if</eucode>
{{{

>
>What would this accomplish?
Suppress warnings. As CoJaBo pointed out you can use without warnings
instead, if you prefer, however I worry that might hide others.

>Anyway, I don't think your code would be sufficient, as we gotta consider
>two criterias here - either is the "general" tab in focus - or not. If it 
>is, I could use Derek's code to test this when the right conditions 
>for the field to be visible is met. But if the "general" tab isn't in focus,
>I'd
>have to wait till it is..
OK, I didn't realise that was part of the problem. I must confess I
did not study Derek's code, I suspect that was a more general purpose
solution (did it have isVisible(getParent(id)) or similar in it?). If
you want to modify my example or post something similar which exhibits
the problem you speak of, I'd be more than happy to investigate.

> The control I'm using to verify the conditions of
>the field is a set of radio buttons (as childs of a group - which again is
>a child of the form itself..) ONE of those radio buttons shows the field,
>the rest hides it. So, if I press the radio button that hides it, but the
>tab page isn't active - how would I go about showing it when the page is
>activated (got focus) at a later stage? 
I'm not absolutely certain, but I'd guess it is perfectly legal to
fixup visibility during the WM_PAINT/w32HPaint event.

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

14. Re: setVisible on tab pages

Pete,

>>First you really gotta explain the - 
>>
>>  if self or event or sequence(params) then end if
>>
>>What would this accomplish?
>Suppress warnings. As CoJaBo pointed out you can use without warnings
>instead, if you prefer, however I worry that might hide others.

Ah, I get it. I usually supress the warnings with the 'without', maybe I
I shouldn't do that.. But I guess I turned it off because of all those
"variables not used" messages.. (Can't remember..) :D

As for the solution for the problem, I'm not sure how to go about. I'm
guessing I could use a true/false variable that tells the system if the
field is supposed to be visible or not. For example, when the user presses 
the radio button it checks first if the right tab has the focus. If it does,
it makes it visible. If it isn't it just sets the variable to true.

I could then create a setHandle that activates when you press the right tab,
page and it will test the variable if it is true. If it is - set the field
to visible... Does this make sense?

That is just the basic priciples, I guess, haven't had time to code and
try it out yet...

Kenneth / ZNorQ

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu