int ContainerSetVisible(int cn, int flag);

 

Sets the visibility of a container and all of its sub-containers.

 

Return Value

 

Return value not used.

 

Parameters

 

cn

Handle to a container where the container was added.  Container zero is defined as the screen.

 

flag

Specifies whether the container should be visible or invisible.  0=invisible; 1=visible.

 

Remarks

 

The ContainerSetVisible() function changes the visibility of a container and all of the containers it owns.  Pass zero to the first parameter to specify the preexisting screen container.

 

Availability

 

Available in DragonFireSDK 2.0 and later.

 

Example

 

The sample code below puts a deck of cards on the screen and when the user touches a card, it is made invisible.

 

#include "DragonFireSDK.h"

 

int Cards[52];

int Containers[52];

int i;

 

int OnTouch(int id, int event, int x, int y)

{

  if (event==1)

   {

      // Hide the selected card.

       ContainerSetVisible(Containers[id],0);

   }

  return(id);

}

 

void AppMain()

{

  int x=0;

  int y=20;

  char buffer[50];

  for (i=0;i<52;i++)

   {

      // Start each card 17 pixels right of the last one.

       x+=17;

      // When we hit the 13th card (King), start a new row

      if (i>0 && i % 13==0)

       {

           x=17;

           y+=110;

       }

      // Create a container and put a view with the next card into it.

       Containers[i]=ContainerAdd(0, x, y);

       sprintf(buffer,"Cards/Card%02d.png",i+1);

       Cards[i]=ViewAdd(Containers[i],buffer,0,0,OnTouch,i);

   }

}

 

void AppExit()

{

 

}

 

void OnTimer()

{

 

}