[Solved] Screen not updating

Post

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

I am sending messages to my user via a label called SysMessage but I am only getting the first one to show

when the form loads I get on screen

Code

labSystemMessage.Caption = "Starting End of Day" & gb.crlf & "Please wait..."
labSystemMessage.Refresh
  and this is correct but then i am sending the message

Code

labSystemMessage.Caption = "Creating End of day Report - Cash In Drawer"
labSystemMessage.Refresh
frmClosePoS.Refresh

But the above message is not being shown (it acts like it is stuck on the first one)

If someone could tell me what I am doing wrong I would appreciate it as I am sending a lot of messages to my user on this form but none of them are being displayed.

This is the code behind the form

Code (gambas)

  1. ' Gambas class file
  2.  
  3. Public Sub Form_Open()
  4.  
  5.  
  6.     labSystemMessage.Caption = "Starting End of Day" & gb.crlf & "Please wait..."
  7.     labSystemMessage.Refresh
  8.    
  9.     With Me.Timer1
  10.         .Delay = 1000
  11.         .Enabled = True
  12.         .Start
  13.     End With
  14.  
  15.  
  16. Public Sub Timer1_Timer()
  17.  
  18.     Sleep 1
  19.     Me.Timer1.Stop
  20.     StartCloseFunction
  21.  
  22.  
  23.  
  24. Private Sub StartCloseFunction()
  25.  
  26.     Select Case global.EndOfDayAction
  27.         Case "Print"
  28.             PrintReportOut
  29.             'SaveFigures
  30.             EndOfDay
  31.            
  32.         Case "SaveOnly"
  33.             'SaveReport
  34.             'SaveFigures
  35.             EndOfDay
  36.            
  37.         Case "SavePrint", "PrintSave"
  38.             PrintReportOut
  39.             'SaveReport
  40.             'SaveFigures
  41.             EndOfDay
  42.     End Select
  43.  
  44.  
  45. Private Sub EndOfDay()
  46.    
  47.     labSystemMessage.Caption = "Resetting PoS Figures to Zero"
  48.     labSystemMessage.Refresh
  49.     ZeroTenderValuesSave
  50.     Sleep 1
  51.    
  52.     frmbackground.Workspace1.CloseAll
  53.     MenuDisplay.ClearMenu
  54.     frmbackground.Workspace1.Add(frmSignedOff, 0)
  55.  
  56.  
  57. Private Sub PrintReportOut()
  58.    
  59.     If global.CaptureCashDrawer = "Yes" Then
  60.         labSystemMessage.Caption = "Creating End of day Report - Cash In Drawer"
  61.         labSystemMessage.Refresh
  62.         frmClosePoS.Refresh
  63.         StartPrint
  64.     End If
  65.  
  66.     labSystemMessage.Caption = "Creating End of day Report - Lottery Summary"
  67.     labSystemMessage.Refresh
  68.     frmClosePoS.Refresh
  69.     LotterySummary
  70.  
  71.     labSystemMessage.Caption = "Creating End of day Report - Payout Summary"
  72.     labSystemMessage.Refresh
  73.     frmClosePoS.Refresh
  74.     PrintPayoutSummary
  75.  
  76.     If global.ModuleCardProcessing = "PaymentSense" Then
  77.         labSystemMessage.Caption = "Running End of Day on Payment Terminal"
  78.         labSystemMessage.Refresh        
  79.         frmClosePoS.Refresh
  80.         'EndOfDayPaymentSense
  81.     End If
  82.  
  83.     labSystemMessage.Caption = "Creating PoS Summary Report"
  84.     labSystemMessage.Refresh    
  85.     frmClosePoS.Refresh
  86.     PoSSummaryReport
  87.  
  88.  
  89.     If global.SafeDropActive = "Yes" Then
  90.         labSystemMessage.Caption = "Creating Safe Drop Summary Report"
  91.         labSystemMessage.Refresh    
  92.         frmClosePoS.Refresh
  93.         SafeDropSummary
  94.     End If
  95.  
  96.     labSystemMessage.Caption = "Reloading PoS Figures"
  97.     labSystemMessage.Refresh    
  98.     frmClosePoS.Refresh
  99.     BootUp.LoadTenderValues
  100.    
  101.     Select Case global.EndOfDayAction
  102.         Case "Print"
  103.             labSystemMessage.Caption = "Printing End Of Day Report"
  104.             labSystemMessage.Refresh
  105.             frmClosePoS.Refresh
  106.             PrinterFunctions.PrintEndOfSlip(0)
  107.             SaveFigures
  108.  
  109.         Case "SaveOnly"
  110.             labSystemMessage.Caption = "Saving End of Day Report"
  111.             labSystemMessage.Refresh
  112.             frmClosePoS.Refresh
  113.             SaveFigures
  114.             'SaveReport
  115.            
  116.             labSystemMessage.Caption = "Saving End of Day Figure"
  117.             labSystemMessage.Refresh
  118.             frmClosePoS.Refresh
  119.             SaveFigures
  120.        
  121.         Case "SavePrint", "PrintSave"
  122.             labSystemMessage.Caption = "Printing End Of Day Report"
  123.             labSystemMessage.Refresh
  124.             frmClosePoS.Refresh
  125.             PrinterFunctions.PrintEndOfSlip(0)
  126.  
  127.             labSystemMessage.Caption = "Saving End of Day Report"
  128.             labSystemMessage.Refresh
  129.             frmClosePoS.Refresh
  130.             'SaveReport
  131.            
  132.             labSystemMessage.Caption = "Saving End of Day Figure"
  133.             labSystemMessage.Refresh
  134.             frmClosePoS.Refresh
  135.             SaveFigures
  136.  
  137.     End Select
  138.  
  139.  
  140.  
  141. Private Sub PrintPayoutSummary()
  142.    
  143.    
  144.    
  145.  
  146.  
  147. Private Sub LotterySummary()
  148.     Dim Totals As Integer = 0
  149.    
  150.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & "~"
  151.     Global.PrinterData &= Global.LeftAlignText & global.BoldDoubleHeightFont & "Lottery Summary" & "~"
  152.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & String(Global.PrinterWidth, "-") & "~"
  153.     Global.PrinterData &= Global.CentreAlignText & global.NormalFont & "** THIS REPORT IS ONLY FOR THIS TERMINAL **" "~"
  154.  
  155.     PrintTenderValue("  NATIONAL LOTTERY", Format((Global.NationLotteryPayout / 100), "£0.00"))
  156.     PrintTenderValue("     EURO MILLIONS", Format((Global.EuroMillionsPayout / 100), "£0.00"))
  157.     PrintTenderValue("      SET FOR LIFE", Format((Global.SetForLifePayout / 100), "£0.00"))
  158.     PrintTenderValue("       THUNDERBALL", Format((Global.ThunderballPayout / 100), "£0.00"))
  159.     PrintTenderValue("   LOTTO HOT PICKS", Format((Global.LottoHotPicksPayout / 100), "£0.00"))
  160.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & "~"
  161.     PrintTenderValue("      SCRACH CARDS", Format((Global.ScrachCardPayout / 100), "£0.00"))
  162.    
  163.     totals = Global.NationLotteryPayout + Global.EuroMillionsPayout + Global.SetForLifePayout + Global.ThunderballPayout + Global.LottoHotPicksPayout + Global.ScrachCardPayout
  164.    
  165.     PrintTotal("Lottery Total", Format((totals / 100), "£0.00"))
  166.    
  167.  
  168.  
  169. 'Private Sub EndOfDayPaymentSense()
  170.    
  171.   ' This makes the Payment Sense Terminal Run the end of day and banking and returns the report to this screen
  172.    'download the data and create a report here
  173.    
  174. 'End
  175.  
  176. Private Sub SaveFigures()
  177.   Dim LocalData As String = Null
  178.  
  179.     LocalData &= Format(Now, "yyyy/mm/dd") & "|"
  180.     LocalData &= Format(Now, "hh:nn") & "|"
  181.     LocalData &= Format(Global.PoSNumber, "000") & "|"
  182.     LocalData &= Format(Global.CashierNumber, "0000") & "|"
  183.     LocalData &= global.CashierNamePrint & "|"
  184.    
  185.    
  186.     LocalData &= Global.Normal_Cash & "|"
  187.     LocalData &= Global.Normal_Cheque & "|"
  188.     LocalData &= Global.Normal_Card & "|"
  189.     LocalData &= Global.Normal_Coupon & "|"
  190.     LocalData &= Global.Normal_GiftVoucher & "|"
  191.     LocalData &= Global.Normal_GiftCard & "|"
  192.     LocalData &= "0|"
  193. '    Global.Normal_OnAccount
  194.    
  195.     LocalData &= Global.refund_Cash & "|"
  196.     LocalData &= Global.refund_Cheque & "|"
  197.     LocalData &= Global.refund_Card & "|"
  198.     LocalData &= Global.refund_Coupon & "|"
  199.     LocalData &= Global.refund_GiftVoucher & "|"
  200.     LocalData &= Global.refund_GiftCard & "|"
  201.     LocalData &= "0|"
  202.     'Global.refund_OnAccount
  203.  
  204.     LocalData &= global.CustomerCount & "|"
  205.     LocalData &= Global.NoSaleCount & "|"
  206.    
  207.     LocalData &= Global.TotalSaleVoids & "|"
  208.     LocalData &= Global.NumberOfTotalSaleVoids & "|"
  209.  
  210.     LocalData &= Global.TotalSafeDrop & "|"
  211.     LocalData &= global.SafeDropCount
  212.    
  213.     SystemFunctions.WriteFileData(Application.path, "EODFigures.eodf", LocalData)
  214.    
  215.  
  216. Private Sub PoSSummaryReport()
  217.     Dim TotalSale As Integer = 0
  218.     Dim TotalRefund As Integer = 0
  219.     Dim TotalFloat As Integer = 0
  220.     Dim Totals As Integer = 0
  221.    
  222.     Global.PrinterData &= Global.LeftAlignText & global.BoldDoubleHeightFont & "PoS Summary" & "~"
  223.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & String(Global.PrinterWidth, "-") & "~"
  224.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & "~"
  225.     Global.PrinterData &= Global.LeftAlignText & global.BoldDoubleHeightFont & "Sales" & "~"
  226.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & String(Global.PrinterWidth, "-") & "~"
  227.  
  228.     Global.PrinterData &= Global.LeftAlignText & global.BoldNormalFont & "TENDER TYPE                         TOTAL" & "~"
  229.    
  230.     PrintTenderValue("              CASH", Format((Global.Normal_Cash / 100), "£0.00"))
  231.     PrintTenderValue("              CARD", Format((Global.Normal_Card / 100), "£0.00"))
  232.     PrintTenderValue("           COUPONS", Format((Global.Normal_Coupon / 100), "£0.00"))
  233.     PrintTenderValue("        GIFT CARDS", Format((Global.Normal_GiftCard / 100), "£0.00"))
  234.     PrintTenderValue("     GIFT VOUCHERS", Format((Global.Normal_GiftVoucher / 100), "£0.00"))
  235.     PrintTenderValue("            CHEQUE", Format((Global.Normal_Cheque / 100), "£0.00"))
  236.     PrintTenderValue("        ON ACCOUNT", Format((Global.Normal_OnAccount / 100), "£0.00"))
  237.    
  238.     TotalSale = Global.Normal_Cash + Global.Normal_Card + Global.Normal_Coupon + Global.Normal_GiftCard + Global.Normal_GiftVoucher + Global.Normal_Cheque + Global.Normal_OnAccount
  239.  
  240.     PrintTotal("Sales Total", Format((TotalSale / 100), "£0.00"))
  241.    
  242.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & "~"
  243.     Global.PrinterData &= Global.LeftAlignText & global.BoldDoubleHeightFont & "Refunds" & "~"
  244.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & String(Global.PrinterWidth, "-") & "~"
  245.     Global.PrinterData &= Global.LeftAlignText & global.BoldNormalFont & "TENDER TYPE                         TOTAL" & "~"
  246.  
  247.     PrintTenderValue("              CASH", Format((Global.refund_Cash / 100), "£0.00"))
  248.     PrintTenderValue("              CARD", Format((Global.refund_Card / 100), "£0.00"))
  249.     PrintTenderValue("           COUPONS", Format((Global.refund_Coupon / 100), "£0.00"))
  250.     PrintTenderValue("        GIFT CARDS", Format((Global.refund_GiftCard / 100), "£0.00"))
  251.     PrintTenderValue("     GIFT VOUCHERS", Format((Global.refund_GiftVoucher / 100), "£0.00"))
  252.     PrintTenderValue("            CHEQUE", Format((Global.refund_Cheque / 100), "£0.00"))
  253.     PrintTenderValue("        ON ACCOUNT", Format((Global.refund_OnAccount / 100), "£0.00"))
  254.  
  255.     TotalRefund = Global.Refund_Cash + Global.Refund_Card + Global.Refund_Coupon + Global.Refund_GiftCard + Global.Refund_GiftVoucher + Global.Refund_Cheque + Global.Refund_OnAccount
  256.  
  257.     PrintTotal("Refunds Total", Format((TotalRefund / 100), "£0.00"))
  258.    
  259.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & "~"
  260.     Global.PrinterData &= Global.LeftAlignText & global.BoldDoubleHeightFont & "Float Summary" & "~"
  261.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & String(Global.PrinterWidth, "-") & "~"
  262.     PrintTenderValue("          FLOAT IN", Format((Global.FloatIn / 100), "£0.00"))
  263.     PrintTenderValue("         FLOAT OUT", Format((Global.FloatIn / 100), "£0.00"))
  264.    
  265.     TotalFloat = global.Floatin - global.FloatOut
  266.    
  267.     PrintTotal("Differance ", Format((TotalFloat / 100), "£0.00"))
  268.      
  269.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & "~"
  270.     Global.PrinterData &= Global.LeftAlignText & global.BoldDoubleHeightFont & "PoS Summary" & "~"
  271.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & String(Global.PrinterWidth, "-") & "~"
  272.    
  273.     PrintTenderValue("    CUSTOMER COUNT", Global.CustomerCount & " ")
  274.     PrintTenderValue("     NO SALE COUNT", Global.NoSaleCount & " ")
  275.     PrintTenderValue(" TOTAL VOIDS COUNT", Global.NumberOfTotalSaleVoids & " ")
  276.     PrintTenderValue(" TOTAL VOIDS VALUE", Format((Global.TotalSaleVoids / 100), "£0.00"))
  277.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & "~"
  278.     PrintTenderValue("   SAFE DROP VALUE", Format((Global.TotalSafeDrop / 100), "£0.00"))
  279.    
  280.    
  281.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & "~"
  282.    
  283.     totals = TotalSale + Global.TotalSafeDrop - TotalRefund
  284.      
  285.     Global.PrinterData &= Global.LeftAlignText & global.BoldDoubleHeightFont & "Terminal Total" & "~"
  286.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & String(Global.PrinterWidth, "-") & "~"
  287.     Global.PrinterData &= Global.RightAlignText & global.BoldDoubleWidthHeightFont & Format((totals / 100), "£0.00") & "~"
  288.  
  289.  
  290.  
  291. Private Sub SafeDropSummary()
  292.     '2022/09/10,20:42,1105,Andrew,100.00
  293.  
  294.     Dim LineData As String = Null
  295.  
  296.     If Exist(SafeDropDataFile) = True Then
  297.         Global.hFile1 = Open SafeDropDataFile For Input
  298.             While Not Eof(Global.hFile1)
  299.                 Line Input #Global.hFile1, Linedata
  300.                
  301.                 global.LineMessages = Split(Linedata, ",")
  302.                
  303.                 Global.LineMessages[0] 'Date
  304.                 Global.LineMessages[1] 'Time
  305.                 Global.LineMessages[2] 'Cashier
  306.                 Global.LineMessages[3] 'Cashier Name
  307.                 Global.LineMessages[4] ' Value Dropped
  308.                
  309.                 'Add to the print out so it can be porinted with the rest of the report
  310.                
  311.  
  312.  
  313.  
  314.             Wend
  315.         Global.hFile1.Close
  316.         'Kill SafeDropDataFile
  317.     Else
  318.        
  319.         ' Print a No Safe Drop done
  320.     End If
  321.    
  322.    
  323.    
  324.    
  325.  
  326.  
  327.  
  328.  
  329. Private Sub StartPrint()
  330. Dim TempPrint As String = global.PrinterData
  331.  
  332.     Global.PrinterData = Null
  333.    
  334.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & String(Global.PrinterWidth, "-") & "~"
  335.     Global.PrinterData &= Global.CentreAlignText & global.BoldDoubleWidthHeightFont & "END OF DAY" & "~"
  336.    
  337.     If global.PrintDayOnReport = "Yes" Then
  338.         Global.PrinterData &= Global.CentreAlignText & global.BoldNormalFont & global.PrintDayOnReportFunction(Now) & "~"
  339.     End If
  340.    
  341.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & String(Global.PrinterWidth, "-") & "~"
  342.  
  343.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & "Cash in drawer" & "~"
  344.     Global.PrinterData &= TempPrint
  345.  
  346.  
  347.  
  348.  
  349.  
  350. Private Sub ZeroTenderValuesSave()
  351.  
  352.     Kill Global.PoSTenderFile
  353.  
  354.     Dim TenderLocalFile As Settings
  355.  
  356.     ' This sets the system to load from the tenders.conf file
  357.     TenderLocalFile = New Settings(Global.PoSTenderFile)
  358.  
  359.                                TenderLocalFile["Tenders/Cash"] = "0"
  360.                                TenderLocalFile["Tenders/Card"] = "0"
  361.                              TenderLocalFile["Tenders/Coupon"] = "0"
  362.                            TenderLocalFile["Tenders/GiftCard"] = "0"
  363.                         TenderLocalFile["Tenders/GiftVoucher"] = "0"
  364.                              TenderLocalFile["Tenders/Cheque"] = "0"
  365.                           TenderLocalFile["Tenders/OnAccount"] = "0"
  366.  
  367.     'Refund Values
  368.                                TenderLocalFile["Refunds/Cash"] = "0"
  369.                                TenderLocalFile["Refunds/Card"] = "0"
  370.                              TenderLocalFile["Refunds/Coupon"] = "0"
  371.                            TenderLocalFile["Refunds/GiftCard"] = "0"
  372.                         TenderLocalFile["Refunds/GiftVoucher"] = "0"
  373.                              TenderLocalFile["Refunds/Cheque"] = "0"
  374.                           TenderLocalFile["Refunds/OnAccount"] = "0"
  375.                    
  376.     'Float Settings
  377.                               TenderLocalFile["Float/FloatIn"] = "0"
  378.                              TenderLocalFile["Float/FloatOut"] = "0"
  379.    
  380.     'Safe Drop Total
  381.                             TenderLocalFile["Safe Drop/Count"] = "0"
  382.                      TenderLocalFile["Safe Drop/TotalDropped"] = "0"
  383.    
  384.     'Lottery Payouts
  385.         TenderLocalFile["Lottery Payouts/NationLotteryPayout"] = "0"
  386.          TenderLocalFile["Lottery Payouts/EuroMillionsPayout"] = "0"
  387.            TenderLocalFile["Lottery Payouts/SetForLifePayout"] = "0"
  388.           TenderLocalFile["Lottery Payouts/ThunderballPayout"] = "0"
  389.         TenderLocalFile["Lottery Payouts/LottoHotPicksPayout"] = "0"
  390.            TenderLocalFile["Lottery Payouts/ScrachCardPayout"] = "0"
  391.  
  392.     'PoS Settings
  393.  
  394.                  TenderLocalFile["PoS Settings/CustomerCount"] = "0"
  395.                    TenderLocalFile["PoS Settings/NoSaleCount"] = "0"
  396.         TenderLocalFile["PoS Settings/NumberOfTotalSaleVoids"] = "0"
  397.                 TenderLocalFile["PoS Settings/TotalSaleVoids"] = "0"
  398.  
  399.  
  400. Private Sub PrintTenderValue(TenderName As String, TenderValue As String)
  401.     Dim SPaceBetweenQtyTotal As Integer = 42 - (String.Len(TenderName) + Len(TenderValue))
  402.    
  403.     Global.PrinterData &= Global.LeftAlignText & global.BoldNormalFont & TenderName & Space(SPaceBetweenQtyTotal) & TenderValue & "~"
  404.  
  405. Private Sub PrintTotal(PrintName As String, TotalValue As String)
  406.     Global.PrinterData &= Global.LeftAlignText & global.NormalFont & String(Global.PrinterWidth, "-") & "~"
  407.     Global.PrinterData &= Global.RightAlignText & global.BoldDoubleHeightFont & PrintName & " " & TotalValue & " " & "~"
  408.  
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
 Try using Wait to let the event loop run

You may find it better to use "Wait 1" where you use "Sleep 1" or whatever the value..

Sleep completely halts your program but Wait will allow the event loop to catch up while it pauses.

I have fixed many an object refresh problem by adding a "Wait" or "Wait 0.1" or "Wait Next" instruction after updating it.
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
something like this…

Code (gambas)

  1.     If global.CaptureCashDrawer = "Yes" Then
  2.         labSystemMessage.Caption = "Creating End of day Report - Cash In Drawer"
  3.         labSystemMessage.Refresh
  4.         frmClosePoS.Refresh
  5.         Wait 0.1
  6.         StartPrint
  7.     End If
  8.  

then all the objects can catch up and refresh in the "Wait" before StartPrint begins

You will find some functions hold up the event loop so using Wait you can let it catch up

Hope that makes sense
Online now: No Back to the top

Post

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

Thanks for that I'll try it when I get to the computer

Also would it be better to keep the timer or would wait 3 wait 3 seconds and then start the process?
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’

AndyGable said

BruceSteers

Thanks for that I'll try it when I get to the computer

Also would it be better to keep the timer or would wait 3 wait 3 seconds and then start the process?

 Defo timer.
If you want to use methods automatically at program start then a timer is best as the Form_Open needs to complete to show your window.  
instructions run in Form_Open happen "before" the window opens so if your GUI shows info for the process it will not be seen.

using a Timer allows the form to open and finish initializing before you begin a process..
Online now: No Back to the top

Post

Posted
Rating:
#6
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 Thanks BruceSteers that worked perfectly
Online now: No Back to the top
1 guest and 0 members have just viewed this.