Hi Everyone
Hope someone can help me I seem to have a slight problem on my hands.
as you are all know I am writing a EPoS application in Gambas. so when I Press Sub total I get my Tender Menu (see below)
so far this is all good. When the user Press F1 (Cash) they would see Image 2
BUT if a user cancels this menu some of the images are not clearing (as you can see in image 3)
I am using Picture1.picture = null (i did try the Picture.clear but Gambas was not happy with this even though the Help saying it clears the image)
Does anyone have any ideas what I would need to do so the images clear fully and the first menu is displayed again
Thanks for any advise anyone can offer men
Kind Regards
Andy
Picture images not clearing
- BruceSteers
- Posts: 1589
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Picture images not clearing
Did you refresh?
Without seeing all the code it's hard to say.
Making .Picture = Null should work.
maybe your code is re-adding the picture somewhere?
Picture1.Picture = Null
Picture1.Refresh
Without seeing all the code it's hard to say.
Making .Picture = Null should work.
maybe your code is re-adding the picture somewhere?
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- cogier
- Site Admin
- Posts: 1128
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Picture images not clearing
I have just tried this and it works OK. Does Picture1 refer to a PictureBox?
- cogier
- Site Admin
- Posts: 1128
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Picture images not clearing
Here is some code you can try in a Graphical application that works OK at this end.
PictureBox1 As PictureBox
HBox1 As HBox
ToggleButton1 As ToggleButton
Public Sub Form_Open()
With Me
.Height = 250
.Width = 200
.Arrangement = Arrange.Vertical
.Padding = 5
End With
With PictureBox1 = New PictureBox(Me) As "PictureBox1"
.Expand = True
.Mode = PictureBox.Contain
.Picture = Picture["icon:/256/access"]
End With
With HBox1 = New HBox(Me)
.Width = 200
.Height = 28
End With
With ToggleButton1 = New ToggleButton(HBox1) As "ToggleButton1"
.Height = 28
.Width = 200
.Text = "&Delete image"
End With
End
Public Sub ToggleButton1_Click()
If ToggleButton1.Value = True Then
PictureBox1.Picture = Null ''Works fine
ToggleButton1.Text = "&Add picture"
Else
PictureBox1.Picture = Picture["icon:/256/access"]
ToggleButton1.Text = "&Delete image"
Endif
End
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: Picture images not clearing
Apologies for the delay in sending this information I was sided tracked on another project
Below is the code i use to clear the labels / Pictures
Public Sub ClearMenu()
Global.MenuControl = ""
With frmbackground
.labFunctionKeyF1.Caption = Null
.PicFunctionF1.Picture = Null
.PicFunctionF1.Refresh
.labFunctionKeyF1.Font.Size = 11
.labFunctionKeyF2.Caption = Null
.PicFunctionF2.Picture = Null
.PicFunctionF2.Refresh
.labFunctionKeyF2.Font.Size = 11
.labFunctionKeyF3.Caption = Null
.PicFunctionF3.Picture = Null
.PicFunctionF3.Refresh
.labFunctionKeyF3.Font.Size = 11
.labFunctionKeyF4.Caption = Null
.PicFunctionF4.Picture = Null
.PicFunctionF4.Refresh
.labFunctionKeyF4.Font.Size = 11
.labFunctionKeyF5.Caption = Null
.PicFunctionF5.Picture = Null
.PicFunctionF5.Refresh
.labFunctionKeyF5.Font.Size = 11
.labFunctionKeyF6.Caption = Null
.PicFunctionF6.Picture = Null
.PicFunctionF6.Refresh
.labFunctionKeyF6.Font.Size = 11
.labFunctionKeyF7.Caption = Null
.PicFunctionF7.Picture = Null
.PicFunctionF7.Refresh
.labFunctionKeyF7.Font.Size = 11
.labFunctionKeyF8.Caption = Null
.PicFunctionF8.Picture = Null
.PicFunctionF8.Refresh
.labFunctionKeyF8.Font.Size = 11
End With
End
This is the code I am using to load the images in to the pictureboxes
Public Sub GetQuickTenderDetails()
Dim QuickTenderResult As Result
Dim $Query As String = ""
$Query &= "Select "
$Query &= "keydescription, "
$Query &= "keyvalue, "
$Query &= "CAST(keyimage AS CHAR) AS keyimage "
$Query &= "from quicktender "
$Query &= "where keyactive='1' "
$Query &= "order by keynumber ASC;"
Dim I As Integer
For I = 0 To 6
Global.QuickTenderName[I] = Null
Global.QuicktenderValue[I] = Null
Next
' ConnectToDatabase
QuickTenderResult = Global.$DBCon.Exec($Query)
If QuickTenderResult.Available = True Then
For I = 0 To 6
Global.QuickTenderName[I] = QuickTenderResult!keydescription
Global.QuicktenderValue[I] = QuickTenderResult!keyvalue
Global.QuickTenderImage[I] = QuickTenderResult!keyimage
QuickTenderResult.MoveNext
Next
End If
' Display Quick Tender options on the menu
MenuDisplay.ClearMenu
Global.MenuControl = "QuickTenderMenu"
With frmbackground
If Global.QuickTenderName[0] <> "" Then
.labFunctionKeyF1.Caption = Global.QuickTenderName[0]
.labFunctionKeyF1.Font.Size = 25
If Global.QuickTenderImage[0] <> "" Then
Global.ImageFromString(Global.QuickTenderImage[0], frmbackground.PicFunctionF1)
Else
frmbackground.PicFunctionF1.Picture = Null
End If
End If
If Global.QuickTenderName[1] <> "" Then
.labFunctionKeyF2.Caption = Global.QuickTenderName[1]
.labFunctionKeyF2.Font.Size = 25
If Global.QuickTenderImage[1] <> "" Then
Global.ImageFromString(Global.QuickTenderImage[1], frmbackground.PicFunctionF2)
Else
frmbackground.PicFunctionF2.Picture = Null
End If
End If
If Global.QuickTenderName[2] <> "" Then
.labFunctionKeyF3.Caption = Global.QuickTenderName[2]
.labFunctionKeyF3.Font.Size = 25
If Global.QuickTenderImage[2] <> "" Then
Global.ImageFromString(Global.QuickTenderImage[2], frmbackground.PicFunctionF3)
Else
frmbackground.PicFunctionF3.Picture = Null
End If
End If
If Global.QuickTenderName[3] <> "" Then
.labFunctionKeyF4.Caption = Global.QuickTenderName[3]
.labFunctionKeyF4.Font.Size = 25
If Global.QuickTenderImage[3] <> "" Then
Global.ImageFromString(Global.QuickTenderImage[3], frmbackground.PicFunctionF4)
Else
frmbackground.PicFunctionF4.Picture = Null
End If
End If
If Global.QuickTenderName[4] <> "" Then
.labFunctionKeyF5.Caption = Global.QuickTenderName[4]
.labFunctionKeyF5.Font.Size = 25
If Global.QuickTenderImage[4] <> "" Then
Global.ImageFromString(Global.QuickTenderImage[4], frmbackground.PicFunctionF5)
Else
frmbackground.PicFunctionF5.Picture = Null
End If
End If
If Global.QuickTenderName[5] <> "" Then
.labFunctionKeyF6.Caption = Global.QuickTenderName[5]
.labFunctionKeyF6.Font.Size = 25
If Global.QuickTenderImage[5] <> "" Then
Global.ImageFromString(Global.QuickTenderImage[5], frmbackground.PicFunctionF6)
Else
frmbackground.PicFunctionF5.Picture = Null
End If
End If
If Global.QuickTenderName[6] <> "" Then
.labFunctionKeyF7.Caption = Global.QuickTenderName[6]
.labFunctionKeyF7.Font.Size = 25
If Global.QuickTenderImage[6] <> "" Then
Global.ImageFromString(Global.QuickTenderImage[6], frmbackground.PicFunctionF7)
Else
frmbackground.PicFunctionF7.Picture = Null
End If
End If
.labFunctionKeyF8.Caption = "Cancel"
Global.pc = Picture.FromString(File.Load(Application.Path &/ "fkeys/cancel.bmp"))
.PicFunctionF8.Picture = Global.pc
.labFunctionKeyF8.Font.Size = 25
End With
End
And just incase it is needed here is the code I am using to load the acual image into the picturebox
Public Function ImageFromString(ImageString As String, ImageFile As PictureBox)
If ImageString <> "" Then
ImageFile.Image = Image.FromString(FromBase64(ImageString))
End If
End
I know this could be better written and optimized but at the moment I just want to sort the issues of the images not clearing.