Screen Saver With in Gambas Application

Post

Posted
Rating:
#1 (In Topic #892)
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 Hi all,

I know i can use the built in screen saver on Linux but I am not using a full desktop just X11

What I want to do is when I display a given screen (frmSignedOff) after 5mins (or what ever I set the time out to be) I would like to start display full screen bmp / png images over my application (but have the application keep focus and respond to the A key (Sign on)

The idea behind this would be to use the user display as a advertising screen when not in use.

Is this possible (as I would like to show a number of "slides"
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
I think it would be best to just open a full screen window to show your slides and have that window monitor the key press event and if A is pressed close itself and go back to the app login.
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
Here's a working class that does that.
you could put any code you like in the SWin_Keypress event to do your login.

Code (gambas)

  1.  
  2. ' Gambas class file
  3.  
  4.  
  5. '' Open the full screen window with a picturebox in it...
  6. Public Sub OpenImageDisplayer()
  7.  
  8.   With SWin = New Window As "SWin"
  9.     .FullScreen = True
  10.     .Arrangement = Arrange.Fill
  11.  
  12.  With PB = New PictureBox(SWin) As "PB"
  13.    .Expand = True
  14.    .Mode = PictureBox.Contain
  15.    .Alignment = Align.Center
  16.  
  17.  SWin.Show()
  18.  
  19.  TM = New Timer As "TM"
  20.  TM.Delay = 3000
  21.  TM.Start
  22.  TM.Trigger
  23.  
  24.  
  25. '' monitor for keypress events
  26. Public Sub SWin_KeyPress()
  27.  
  28.   If Key.Text = "a" Then
  29.     TM.Stop
  30.     SWin.Close
  31.  
  32.  
  33. '' A timer to randomly pic an image from my Pictures folder and load it in the PictureBox
  34. Public Sub TM_Timer()
  35.  
  36.   Dim sPics As String[] = Dir(User.Home &/ "Pictures", "*.png", gb.file)
  37.   sPics.Shuffle()
  38.   PB.Picture = Picture.Load(User.Home &/ "Pictures" &/ sPics[0])
  39.  
  40.  
  41.  
Online now: No Back to the top

Post

Posted
Rating:
#4
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

BruceSteers said

Here's a working class that does that.
you could put any code you like in the SWin_Keypress event to do your login.

Code (gambas)

  1.  
  2. ' Gambas class file
  3.  
  4.  
  5. '' Open the full screen window with a picturebox in it...
  6. Public Sub OpenImageDisplayer()
  7.  
  8.   With SWin = New Window As "SWin"
  9.     .FullScreen = True
  10.     .Arrangement = Arrange.Fill
  11.  
  12.  With PB = New PictureBox(SWin) As "PB"
  13.    .Expand = True
  14.    .Mode = PictureBox.Contain
  15.    .Alignment = Align.Center
  16.  
  17.  SWin.Show()
  18.  
  19.  TM = New Timer As "TM"
  20.  TM.Delay = 3000
  21.  TM.Start
  22.  TM.Trigger
  23.  
  24.  
  25. '' monitor for keypress events
  26. Public Sub SWin_KeyPress()
  27.  
  28.   If Key.Text = "a" Then
  29.     TM.Stop
  30.     SWin.Close
  31.  
  32.  
  33. '' A timer to randomly pic an image from my Pictures folder and load it in the PictureBox
  34. Public Sub TM_Timer()
  35.  
  36.   Dim sPics As String[] = Dir(User.Home &/ "Pictures", "*.png", gb.file)
  37.   sPics.Shuffle()
  38.   PB.Picture = Picture.Load(User.Home &/ "Pictures" &/ sPics[0])
  39.  
  40.  
  41.  

Thank-you so much BruceSteers I shall try that when I get home
Online now: No Back to the top
1 guest and 0 members have just viewed this.