[EXAMPLES]

* BUG: Fix WebCam example.


git-svn-id: svn://localhost/gambas/trunk@5855 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2013-09-28 17:10:23 +00:00
parent bec232900d
commit 95f65e2310
3 changed files with 21 additions and 23 deletions

View file

@ -1,9 +1,9 @@
# Gambas Project File 3.0
# Compiled with Gambas 3.3.90
# Compiled with Gambas 3.4.90
Title=Webcam example
Startup=Form1
Icon=camera.png
Version=3.3.90
Version=3.4.90
VersionFile=1
Component=gb.image
Component=gb.gui

View file

@ -46,7 +46,7 @@ Public Sub _new(dev As VideoDevice, i As Integer)
End
Public Sub Resize()
Public Sub ResizeDevice()
Dim $spacing As Integer
@ -101,7 +101,7 @@ Public Sub Resize()
End
Public Sub form_Show()
Public Sub Form_Show()
Dim key As String = Subst("Camera_&1", $index)
@ -122,7 +122,7 @@ Public Sub Form_Open()
picture_size.Index = Settings[key & "/size", 1] - 1
picture_size_Click()
Resize()
ResizeDevice()
Wait 0.1
slider_bright.Value = Settings[key & "/brightness", $device.Bright]
@ -140,17 +140,6 @@ Public Sub Form_Open()
End
Public Sub Close() As Integer
Refresh.Stop
Me.Hide
Wait
$device.Close
$device = Null
End
Public Sub Refresh_Timer()
Dim when As Date
@ -190,7 +179,7 @@ Public Sub picture_size_Click()
$device.Resize(640, 480)
End Select
Resize()
ResizeDevice()
End
@ -235,7 +224,7 @@ End
Public Sub button_hide_Click()
tools.Hide()
Resize()
ResizeDevice()
End
@ -285,7 +274,7 @@ Public Sub buttonSettings_Click()
Else
tools.Show
Endif
Resize()
ResizeDevice()
Select $device.Width
Case 160
@ -307,3 +296,11 @@ Public Sub button_reset_Click()
slider_hue.Value = $device.HueDefault
End
Public Sub Form_Close()
Refresh.Stop
$device.Close
$device = Null
End

View file

@ -17,6 +17,7 @@ Public Sub ScanDevices()
Dim count As Integer
Dim item As Menu
Dim status As String
Dim sDevice As String
$windows = New Form[]
count = 0
@ -24,7 +25,9 @@ Public Sub ScanDevices()
status = "Searching: "
For i = 0 To 20
Try dev = New VideoDevice("/dev/video" & Str(i))
sDevice = "/dev/video" & Str(i)
Print sDevice
Try dev = New VideoDevice(sDevice)
If Not Error Then
status &= "!"
myWin = New FDevice(dev, count)
@ -48,8 +51,6 @@ Public Sub ScanDevices()
myWin.Show
Next
Catch
End
Public Sub menu_scan_Click()
@ -96,12 +97,12 @@ Public Sub menu_quit_Click()
$windows.Pop().Close
Wend
Me.Close
tooltray.Hide
End
Public Sub menu_save_Click()
Dim key As String
Dim mywin As FDevice
For Each myWin In $windows