The window does not open (was: Can't find the error)

Just starting out? Need help? Post your questions and find answers here.
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

The window does not open (was: Can't find the error)

Post by ClueLess »

Hi All

I designed this program as parte of a bigger aplication but it gives an erron on the repeat loop

Code: Select all

;
; This code is automatically generated by the Form Designer.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures need to be put in another source file.
;

Enumeration FormWindow
  #ArtigosWin
EndEnumeration

Enumeration FormGadget
  #Txt_Codigo_Item
  #Txt_Descricao_Item
  #Txt_Custo_Item
  #Txt_Margem_Item
  #Txt_Desconto_Item
  #Opt_Unidade_Item
  #Opt_IVA_Item
  #But_Guardar_Artigo
  #But_Cancelar_Artigo
  #But_Limpar_Artigo
  #Lbl_Codigo_Item
  #Lbl_Descricao_Item
  #Lbl_Unidade_Item
  #Lbl_Custo_Item
  #Lbl_Margem_Item
  #Lbl_IVA_Item
  #Lbl_Desconto_Item
  #Lbl_IVA_Item_Copy1
EndEnumeration

Procedure OpenArtigos(x = 0, y = 0, width = 647, height = 213)
  OpenWindow(#ArtigosWin, x, y, width, height, "", #PB_Window_SystemMenu)
  StringGadget(#Txt_Codigo_Item, 27, 40, 100, 20, "")
  StringGadget(#Txt_Descricao_Item, 147, 40, 353, 20, "")
  StringGadget(#Txt_Custo_Item, 100, 100, 20, 0, "")
  StringGadget(#Txt_Margem_Item, 147, 100, 100, 20, "")
  StringGadget(#Txt_Desconto_Item, 274, 100, 100, 20, "")
  ListViewGadget(#Opt_Unidade_Item, 527, 40, 100, 20)
  AddGadgetItem(#Opt_Unidade_Item, -1, "Unidade")
  AddGadgetItem(#Opt_Unidade_Item, -1, "Metro")
  AddGadgetItem(#Opt_Unidade_Item, -1, "Hora")
  ListViewGadget(#Opt_IVA_Item, 527, 100, 100, 20)
  AddGadgetItem(#Opt_IVA_Item, -1, "14%")
  AddGadgetItem(#Opt_IVA_Item, -1, "Isento")
  ButtonGadget(#But_Guardar_Artigo, 527, 167, 100, 20, "Guardar")
  ButtonGadget(#But_Cancelar_Artigo, 400, 167, 100, 20, "Cancelar")
  ButtonGadget(#But_Limpar_Artigo, 273, 167, 100, 20, "Limpar Form")
  TextGadget(#Lbl_Codigo_Item, 27, 20, 100, 17, "Codigo")
  TextGadget(#Lbl_Descricao_Item, 147, 20, 100, 17, "Descrição")
  TextGadget(#Lbl_Unidade_Item, 527, 20, 100, 17, "Unidade")
  TextGadget(#Lbl_Custo_Item, 27, 80, 100, 17, "Preço de Custo")
  TextGadget(#Lbl_Margem_Item, 147, 80, 100, 17, "Margem")
  TextGadget(#Lbl_IVA_Item, 401, 80, 100, 17, "Taxa de IVA")
  TextGadget(#Lbl_Desconto_Item, 274, 80, 100, 17, "Deconto %")
  TextGadget(#Lbl_IVA_Item_Copy1, 527, 80, 100, 17, "Taxa de IVA")
EndProcedure

Procedure Artigos_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  
  ProcedureReturn #True
EndProcedure

Repeat
  WaitWindowEvent()
ForEver

I have another similar application witch works fine. Can someone help me with this?

Thanks
User avatar
TI-994A
Addict
Addict
Posts: 2698
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: The window does not open (was: Can't find the error)

Post by TI-994A »

ClueLess wrote: Tue Sep 17, 2024 5:40 pm...it gives an erron on the repeat loop

It works once a window is opened - simply call OpenArtigos():

Code: Select all

;
; This code is automatically generated by the Form Designer.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures need to be put in another source file.
;

Enumeration FormWindow
  #ArtigosWin
EndEnumeration

Enumeration FormGadget
  #Txt_Codigo_Item
  #Txt_Descricao_Item
  #Txt_Custo_Item
  #Txt_Margem_Item
  #Txt_Desconto_Item
  #Opt_Unidade_Item
  #Opt_IVA_Item
  #But_Guardar_Artigo
  #But_Cancelar_Artigo
  #But_Limpar_Artigo
  #Lbl_Codigo_Item
  #Lbl_Descricao_Item
  #Lbl_Unidade_Item
  #Lbl_Custo_Item
  #Lbl_Margem_Item
  #Lbl_IVA_Item
  #Lbl_Desconto_Item
  #Lbl_IVA_Item_Copy1
EndEnumeration

Procedure OpenArtigos(x = 0, y = 0, width = 647, height = 213)
  OpenWindow(#ArtigosWin, x, y, width, height, "", #PB_Window_SystemMenu)
  StringGadget(#Txt_Codigo_Item, 27, 40, 100, 20, "")
  StringGadget(#Txt_Descricao_Item, 147, 40, 353, 20, "")
  StringGadget(#Txt_Custo_Item, 100, 100, 20, 0, "")
  StringGadget(#Txt_Margem_Item, 147, 100, 100, 20, "")
  StringGadget(#Txt_Desconto_Item, 274, 100, 100, 20, "")
  ListViewGadget(#Opt_Unidade_Item, 527, 40, 100, 20)
  AddGadgetItem(#Opt_Unidade_Item, -1, "Unidade")
  AddGadgetItem(#Opt_Unidade_Item, -1, "Metro")
  AddGadgetItem(#Opt_Unidade_Item, -1, "Hora")
  ListViewGadget(#Opt_IVA_Item, 527, 100, 100, 20)
  AddGadgetItem(#Opt_IVA_Item, -1, "14%")
  AddGadgetItem(#Opt_IVA_Item, -1, "Isento")
  ButtonGadget(#But_Guardar_Artigo, 527, 167, 100, 20, "Guardar")
  ButtonGadget(#But_Cancelar_Artigo, 400, 167, 100, 20, "Cancelar")
  ButtonGadget(#But_Limpar_Artigo, 273, 167, 100, 20, "Limpar Form")
  TextGadget(#Lbl_Codigo_Item, 27, 20, 100, 17, "Codigo")
  TextGadget(#Lbl_Descricao_Item, 147, 20, 100, 17, "Descrição")
  TextGadget(#Lbl_Unidade_Item, 527, 20, 100, 17, "Unidade")
  TextGadget(#Lbl_Custo_Item, 27, 80, 100, 17, "Preço de Custo")
  TextGadget(#Lbl_Margem_Item, 147, 80, 100, 17, "Margem")
  TextGadget(#Lbl_IVA_Item, 401, 80, 100, 17, "Taxa de IVA")
  TextGadget(#Lbl_Desconto_Item, 274, 80, 100, 17, "Deconto %")
  TextGadget(#Lbl_IVA_Item_Copy1, 527, 80, 100, 17, "Taxa de IVA")
EndProcedure

Procedure Artigos_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  
  ProcedureReturn #True
EndProcedure

OpenArtigos()

Repeat
  WaitWindowEvent()
ForEver
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
mk-soft
Always Here
Always Here
Posts: 6204
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: The window does not open (was: Can't find the error)

Post by mk-soft »

Do Not Edit The Form.pbf File. Always overwrite from FormDesigner

Create a main.pb with this code. Check your file name if *.pbf

Code: Select all

XIncludeFile "Form.pbf"

OpenArtigosWin()

Repeat
  event = WaitWindowEvent()
  
  Select EventWindow()
    Case #ArtigosWin
      If ArtigosWin_Events(event) = #False
        Break
      EndIf
      
  EndSelect
ForEver
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: The window does not open (was: Can't find the error)

Post by ClueLess »

Thank You All

It now started working without making any change

Thank You
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: The window does not open (was: Can't find the error)

Post by ClueLess »

Hi

I was wrong. Was testing the working one.

Replaced the repeat loop with: Repeat Until #PB_Event_CloseWindow and now get the error Garbage at the end of the line

What the hell is going on?
User avatar
TI-994A
Addict
Addict
Posts: 2698
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: The window does not open (was: Can't find the error)

Post by TI-994A »

ClueLess wrote: Tue Sep 17, 2024 6:54 pmRepeat Until #PB_Event_CloseWindow

The correct condition should be:

Code: Select all

Repeat
  event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: The window does not open (was: Can't find the error)

Post by ClueLess »

Solved

Removed the Procedure command at the beguining. Display the Window on the code flow
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: The window does not open (was: Can't find the error)

Post by boddhi »

Hello ClueLess,
ClueLess wrote: Solved
Maybe you can modify your initial post's title to indicate that it's solved.
This is part of good forum practice :wink:
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Post Reply