ok just to update this,
the requester now works as intended but i am now getting invalid memory address....
code to test below.
The error is generated at end of procedure.
also tested same code with subroutine and same error.
code without textgadgets works fine.
Code:
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#String_0
#String_1
#String_2
#Button_0
#String_3
EndEnumeration
Procedure Open_Window_0()
If OpenWindow(#Window_0, 586, 176, 600, 300, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
StringGadget(#String_0, 40, 20, 250, 30, "")
StringGadget(#String_1, 40, 60, 250, 30, "")
StringGadget(#String_2, 40, 100, 250, 30, "")
ButtonGadget(#Button_0, 330, 30, 140, 80, "PRINT")
StringGadget(#String_3, 40, 160, 70, 40, "")
EndIf
EndIf
EndProcedure
Procedure printit()
def$="Yes"
type$="MEMBER"
fontA.s=""
fontB.s=""
Size1.s=""
ESC.s=Chr(27)
If def$="Yes"
printer.s=LPRINT_Requester()
Else
printer.s=LPRINT_GetDefaultPrinter()
EndIf
If LPRINT_OpenPrinter(printer.s)
If LPRINT_StartDoc("Receipt Print")
LPRINT_PrintN(Chr(28)+Chr(112)+Chr(1)+Chr(48))
LPRINT_PrintN("North Shields")
LPRINT_Print(Chr(29)+Chr(33)+Chr(32))
LPRINT_Print(Esc+Chr(33)+Chr(0))
z1$=GetGadgetText(#String_0)
t1$=Mid(z1$,FindString(z1$,":",1)+1,Len(z1$))+" : "+Str(Hour(Date()))+":"+Str(Minute(Date()))
z2$=GetGadgetText(#String_1)
z3$=GetGadgetText(#String_2)
z4$=GetGadgetText(#String_3)
LPRINT_PrintN(t1$)
LPRINT_PrintN(z2$)
If z3$="MEMBER"
t$= "00010"+" "+"Mr "+" "+"S"+" "+"Smith"+" Points : "+"0900"
Else
t$= "09999"+" "+z3$
EndIf
LPRINT_PrintN(t$)
LPRINT_PrintN("")
LPRINT_PrintN("")
LPRINT_PrintN("")
LPRINT_Print(ESC+Chr(j)+Chr(10))
LPRINT_EndDoc()
EndIf
LPRINT_ClosePrinter()
EndIf
EndProcedure
Open_Window_0()
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadget() ; Is it a gadget event?
EventType = EventType() ; The event type
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_Event_Gadget
If GadgetID = #String_0
ElseIf GadgetID = #String_1
ElseIf GadgetID = #String_2
ElseIf GadgetID = #Button_0
printit()
ElseIf GadgetID = #String_3
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
End
;