Page 1 of 1

Line 4 Does not Print

Posted: Fri Nov 13, 2009 11:16 pm
by Hot Pockets
This is a program that should enter 18 facts for a configuration file. The Splash Screen comes on nicely,The main Menu works great. When I select the 1st sub program(More will follow I hope) the 4th TextGadget does not show but the 4th
string Gadget does! Why? When the program ends it comes up with a deprecated function message and HiLites the
CreateGadgetList Line. What does a deprecated function mean, do i need a Doctor? :?
Procedure Config()
Enumeration
#WIN_0
#TEXT_INPUT
#STRING_INPUT
#BUTTON_CLOSE
EndEnumeration
XX$ = FormatDate("%mm/%dd/%yyyy", Date())
Date$ = XX$
ZZ$ = Space(18) + "CREATE CONFIGURATION FILE" + Space(138) + "Date: " + Date$
#Result = #PB_Window_TitleBar | #PB_Window_ScreenCentered
If OpenWindow(#WIN_0, 0, 0, 1024, 768, ZZ$,#Result)
If CreateGadgetList(#WIN_0)
TextGadget(0, 90, 68, 400, 24, "1. Account Identification Number...............")
TextGadget(1, 90, 100, 400, 24, "2. Account Owner's Name........................")
TextGadget(2, 90, 132, 400, 24, "3. Name of Bank Holding Account................")
TextGadget(3, 90, 163, 400, 24, "4. Starting Check Number of Account............")*********************************************
TextGadget(4, 90, 196, 400, 24, "5. Starting Balance of Account.................")<- This TextGadjet does not Print od SCR
TextGadget(5, 90, 228, 400, 24, "6. Last Register Letter Used...................") **********************************************
TextGadget(6, 90, 260, 400, 24, "7. Will Use Debit Category Codes...............")
TextGadget(7, 90, 292, 400, 24, "8. Will Use Credit Category Codes..............")
TextGadget(8, 90, 324, 400, 24, "9. Uses Pre-Assigned Debit Transactions........")
TextGadget(9, 90, 356, 400, 24, "10. Uses Pre-Assigned Credit Transactions......")
TextGadget(10, 90, 388, 400, 24, "11. Can Log Cash Debits and Cash Saves.........")
TextGadget(11, 90, 420, 400, 24, "12. Password For This Account is...............")
TextGadget(12, 90, 452, 400, 24, "13. Last UnCleared Transaction Number..........")
TextGadget(13, 90, 484, 400, 24, "14. Last Transaction Number is.................")
TextGadget(14, 90, 516, 400, 24, "15. Last Split Transaction Number..............")
TextGadget(15, 90, 548, 400, 24, "16. Last Sequential Transaction Number.........")
TextGadget(16, 90, 580, 400, 24, "17. Last Reconciled Amount.....................")
TextGadget(17, 90, 612, 400, 24, "18. Last Correct Balance.......................")
StringGadget(18, 470, 64, 250, 24, "")
StringGadget(19, 470, 96, 250, 24, "")
StringGadget(20, 470,128, 250, 24, "")
StringGadget(21, 470,160, 250, 24, "")
StringGadget(22, 470,192, 250, 24, "")
StringGadget(23, 470,224, 250, 24, "")
StringGadget(24, 470,256, 250, 24, "")
StringGadget(25, 470,288, 250, 24, "")
StringGadget(26, 470,320, 250, 24, "")
StringGadget(27, 470,352, 250, 24, "")
StringGadget(28, 470,384, 250, 24, "")
StringGadget(29, 470,416, 250, 24, "")
StringGadget(30, 470,448, 250, 24, "")
StringGadget(31, 470,480, 250, 24, "")
StringGadget(32, 470,512, 250, 24, "")
StringGadget(33, 470,544, 250, 24, "")
StringGadget(34, 470,576, 250, 24, "")
StringGadget(35, 470,608, 250, 24, "")


ButtonGadget(#BUTTON_CLOSE, 900, 660, 60,24,"Save")

SetActiveGadget(#STRING_INPUT)
Repeat
Event.l = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case #BUTTON_CLOSE
; Quit = #True
MainMenu()
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow Or Quit = #True
EndIf
EndIf
EndProcedure

Re: Line 4 Does not Print

Posted: Fri Nov 13, 2009 11:43 pm
by rsts
It's more difficult to help without working code.

Got some?

cheers

Re: Line 4 Does not Print

Posted: Sat Nov 14, 2009 12:01 am
by Kaeru Gaman
please use Code-Tags next time!

your Problem is, that your constant #BUTTON_CLOSE has the Value 4.
creating the Button with the same number erases the stringgadget.

use Enums for ALL your Gadgets, or create the others dynamically.

Re: Line 4 Does not Print

Posted: Sat Nov 14, 2009 12:36 am
by Hot Pockets
Mr Gaman
Thank you. Did you mean that I should enter all These GadGets in the enumeration file I had at the top of the screen? If that's what you mean then I am amazed because my program will have apprximately 40 other similar yet different programsand I could easily end uo with Enumeration blocks holding upwards of 58 + constants some26 alike? I am now thoughly bewildered.

Re: Line 4 Does not Print

Posted: Sat Nov 14, 2009 1:15 am
by Kaeru Gaman
well... yes.
at least all windows that could be open at the same time should have different Gadget numbers.
... and since you can get focus away from most windows, all your Gadgets in your whole program need a unique number.

if you dont want to declare that much constants, you can create the Gadgets dynamically, means,
you create them using #PB_Any for the number and put the ReturnValue of the Create into e.g. an Array.
the Value in the Array then is the ID you need to put into the Cases or any other call you need the GadgetNumber.

honestly, it would be easier to declare the needed Constants.
Window-Numbers and Gadget-Numbers can overlap, so use different Enums.
and use ONE Enum for ALL the Gadgets right at the beginning of your code, not seperated within the Procedures.
those Constants will be declared on CompileTime, no need to have the code in a place that will be run thru on RunTime.

Re: Line 4 Does not Print

Posted: Sat Nov 14, 2009 5:29 pm
by Hot Pockets
Thank you. I will try and do what you say. First I need to find out how to make this thing get back to the main menu?
ButtonGadget( 36, 900, 660, 60,24,"Save")

SetActiveGadget(18) ; This is the 1st of 18 String Gadgets
Repeat
Event.l = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
; Debug Event
Select EventGadget()
Case #BUTTON_CLOSE
; Quit = #True
MainMenu()
Default
Debug Event
EndSelect
EndSelect
Result = GetGadgetState(36)
Debug Result
Until Event = #PB_Event_CloseWindow Or Quit = #True
I wrote the program I am trying to re write in Basic 7.11 18 years ago. I have tried 9 other dialects of basic and have come up short. PDS 7.11 was so easy compared to all these others, Ibasic, Dark Basic, Rapid Basic,VB 6, ect edt :(

Re: Line 4 Does not Print

Posted: Sat Nov 14, 2009 5:47 pm
by Kaeru Gaman
would you please use code tags!

Re: Line 4 Does not Print

Posted: Sat Nov 14, 2009 6:30 pm
by luis
Hot Pockets wrote: I wrote the program I am trying to re write in Basic 7.11 18 years ago. I have tried 9 other dialects of basic and have come up short. PDS 7.11 was so easy compared to all these others, Ibasic, Dark Basic, Rapid Basic,VB 6, ect edt :(
Sorry for the little off-topic: if you haven't tried FreeBasic maybe you could try that too. Should be very similar to quickbasic (and so PDS 7 too). With a lot of stuff added obviously. I'm not suggesting you to leave PB for it, but since you mentioned PDS... I used it a lot for work SOME years ago, it was a good language/compiler at the time :)

Re: Line 4 Does not Print

Posted: Sun Nov 15, 2009 7:00 pm
by Hot Pockets
Thank You Luis,I will try it!
Mr Gaman, I spent all of last night searching for the instructions on how to use Tags. I went thru the FAQS, no mention of it there, I searced the forum osts -nada finally I remembered you had asked that of me so I went back 1 by 1 thru a cisideable amount of pages and found an explanation. I would respectfully suggest that this important idea should have a place in The FAQS section. below is the code with tags:

Code: Select all

ButtonGadget( 36, 900, 660, 60,24,"Save")

SetActiveGadget(18) ; This is the 1st of 18 String Gadgets
Repeat
Event.l = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
; Debug Event
Select EventGadget()
Case #BUTTON_CLOSE
; Quit = #True
MainMenu()
Default
Debug Event
EndSelect
EndSelect 
Result = GetGadgetState(36)
Debug Result
Until Event = #PB_Event_CloseWindow Or Quit = #True 
Personally I would think Placing the code between to Lines of asterisks would be far more preferabl as I had to edit my post
since the code tags did not encircle the code.
What I am attempting to do is to have the button respond when I click it or hit enter when it is

Re: Line 4 Does not Print

Posted: Sun Nov 15, 2009 8:33 pm
by Kaeru Gaman
I'm sorry, I thought the term "TAG" for some in-text-command is wellknown nowadays, it's the same in HTML, XML, maybe even SQL, not sure.
additionally, you should have regognized that there where a formatting difference between your posting and all the others.

when you press a tag button, both tags appear with the cursor between them.
when you mark a certain part of your posting and press a tag button, the marked text gets enclosed in the tags.

the main reasons are, Code-Tags preserve the indentions and use a monospace font.
code is far far far better readable this way.
it's a matter of "help others to help you"

to your problem:

Code: Select all

Case #BUTTON_CLOSE
  Quit = #True
  ; MainMenu()
since your Config() probably will be called from MainMenu(), you should not call back but just leave Config() when it's ready.
but you'll better use a single Mainloop for all of your Windows that may be open at any time.
several examples can be found here:
http://www.purebasic.fr/english/viewtop ... 31#p175031
links to my example, but there are more around the topic.

Re: Line 4 Does not Print

Posted: Mon Nov 16, 2009 11:18 pm
by harkon
Hot Pockets wrote: I wrote the program I am trying to re write in Basic 7.11 18 years ago. I have tried 9 other dialects of basic and have come up short. PDS 7.11 was so easy compared to all these others, Ibasic, Dark Basic, Rapid Basic,VB 6, ect edt :(
One of the biggest leaps from the DOS world is writing the GUI. This is one of the reasons VB (3 thru 6) were so incredibly successful. The Gui designer is / was really good. It's a really good feature in PureBasic and, although some people dislike PB's Visual Designer, I personally use it a lot. Moving from QB or PDS to VB involved moving from a strictly procedural language to an event driven language. In VB whenever something happens, an event is fired, and you simply write the routine for that event. In PB you write the event loop. This makes the entire goings on of your program completely transparent, but you have the extra effort of maintaining the entire event loop. The Visual designer will generate the event loop for you so it's not that big of a step to make. If you start with a simple program you'll quickly see how easy this really is. I personally find writing a GUI without the aid of a designer incredibly tedious and it seems to take me forever. I like the idea that the Visual Designer generates actual code that I can tweak and bend after the fact.

Here's your code as generated by the Visual Designer;

Include File:

Code: Select all

; PureBasic Visual Designer v3.95 build 1485 (PB4Code)


;- Window Constants
;
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
;
Enumeration
  #Text_0
  #Text_1
  #Text_2
  #Text_3
  #Text_4
  #Text_5
  #Text_6
  #Text_7
  #Text_8
  #Text_09
  #Text_10
  #Text_11
  #Text_14
  #Text_12
  #Text_13
  #Text_15
  #Text_16
  #Text_17
  #String_0
  #String_1
  #String_2
  #String_3
  #String_4
  #String_5
  #String_6
  #String_7
  #String_8
  #String_9
  #String_10
  #String_11
  #String_12
  #String_13
  #String_14
  #String_15
  #String_16
  #String_17
  #Button_0
EndEnumeration


Procedure Open_Window_0()
  If OpenWindow(#Window_0, 246, 92, 1028, 770, "CREATE CONFIGURATION FILE",  #PB_Window_TitleBar | #PB_Window_ScreenCentered )
    ;If CreateGadgetList(WindowID(#Window_0))
      TextGadget(#Text_0, 90, 68, 400, 24, "1. Account Identification Number...............")
      TextGadget(#Text_1, 90, 100, 400, 24, "2. Account Owner's Name........................")
      TextGadget(#Text_2, 89, 132, 400, 24, "3. Name of Bank Holding Account................")
      TextGadget(#Text_3, 90, 163, 400, 24, "4. Starting Check Number of Account............")
      TextGadget(#Text_4, 90, 196, 400, 24, "5. Starting Balance of Account.................")
      TextGadget(#Text_5, 90, 228, 400, 24, "6. Last Register Letter Used...................")
      TextGadget(#Text_6, 90, 260, 400, 24, "7. Will Use Debit Category Codes...............")
      TextGadget(#Text_7, 90, 292, 400, 24, "8. Will Use Credit Category Codes..............")
      TextGadget(#Text_8, 90, 324, 400, 24, "9. Uses Pre-Assigned Debit Transactions........")
      TextGadget(#Text_09, 90, 356, 400, 24, "10. Uses Pre-Assigned Credit Transactions......")
      TextGadget(#Text_10, 90, 388, 400, 24, "11. Can Log Cash Debits and Cash Saves.........")
      TextGadget(#Text_11, 90, 420, 400, 24, "12. Password For This Account is...............")
      TextGadget(#Text_14, 90, 452, 400, 24, "13. Last UnCleared Transaction Number..........")
      TextGadget(#Text_12, 90, 483, 400, 24, "14. Last Transaction Number is.................")
      TextGadget(#Text_13, 90, 516, 400, 24, "15. Last Split Transaction Number..............")
      TextGadget(#Text_15, 90, 548, 400, 24, "16. Last Sequential Transaction Number.........")
      TextGadget(#Text_16, 90, 580, 400, 24, "17. Last Reconciled Amount.....................")
      TextGadget(#Text_17, 89, 612, 400, 24, "18. Last Correct Balance.......................")
      StringGadget(#String_0, 470, 64, 250, 24, "")
      StringGadget(#String_1, 470, 96, 250, 24, "")
      StringGadget(#String_2, 470, 128, 250, 24, "")
      StringGadget(#String_3, 470, 160, 250, 24, "")
      StringGadget(#String_4, 470, 192, 250, 24, "")
      StringGadget(#String_5, 470, 224, 250, 24, "")
      StringGadget(#String_6, 470, 256, 250, 24, "")
      StringGadget(#String_7, 470, 288, 250, 24, "")
      StringGadget(#String_8, 470, 320, 250, 24, "")
      StringGadget(#String_9, 470, 352, 250, 24, "")
      StringGadget(#String_10, 470, 384, 250, 24, "")
      StringGadget(#String_11, 470, 416, 250, 24, "")
      StringGadget(#String_12, 470, 448, 250, 24, "")
      StringGadget(#String_13, 470, 480, 250, 24, "")
      StringGadget(#String_14, 470, 512, 250, 24, "")
      StringGadget(#String_15, 470, 544, 250, 24, "")
      StringGadget(#String_16, 470, 576, 250, 24, "")
      StringGadget(#String_17, 470, 608, 250, 24, "")
      ButtonGadget(#Button_0, 900, 660, 60, 24, "Save")
      
    ;EndIf
  EndIf
EndProcedure
Main File (Including Event Loop)

Code: Select all

; PureBasic Visual Designer v3.95 build 1485 (PB4Code)

IncludeFile "Include.pb"

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 = #String_3
      
    ElseIf GadgetID = #String_4
      
    ElseIf GadgetID = #String_5
      
    ElseIf GadgetID = #String_6
      
    ElseIf GadgetID = #String_7
      
    ElseIf GadgetID = #String_8
      
    ElseIf GadgetID = #String_9
      
    ElseIf GadgetID = #String_10
      
    ElseIf GadgetID = #String_11
      
    ElseIf GadgetID = #String_12
      
    ElseIf GadgetID = #String_13
      
    ElseIf GadgetID = #String_14
      
    ElseIf GadgetID = #String_15
      
    ElseIf GadgetID = #String_16
      
    ElseIf GadgetID = #String_17
      
    ElseIf GadgetID = #Button_0
      Break      ;I included this to give an easy exit
      
    EndIf
    
  EndIf
  
Until Event = #PB_Event_CloseWindow ; End of the event loop

End
;
As you can see the code is much cleaner and way easier to read. If you start with the Visual Designer, at least you'll get the feel for how to get the GUI written in PB. Many here manually code the GUI, but most will follow the general outline the Visual Designer uses.

Oh, BTW, I'm still using PB4.31 so if things look different in 4.4, then I'm sorry.

Re: Line 4 Does not Print

Posted: Tue Nov 17, 2009 2:13 am
by Hot Pockets
Thank you Mr Gaman
Mr Harkon, Interesting but I think I'm going to go back to VB6. I personally find it easier to read and maybe something was wrong with my computer. I got my program more then half re-writtenmore and if could find out what ails it(or me) I would be ahead of the game. I won't be around at least for a while and thanks to all who helped me!
Hot Pockets

Re: Line 4 Does not Print

Posted: Tue Nov 17, 2009 3:55 pm
by harkon
Although there are a lot of tools available for VB6, I think you'll find that PB can be a much richer environment. With that having been said, simplicity is VB. I prefer PB and haven't used VB in a while. While VB is a good programming platform, it's really easy to end up in .DLL hell. So far in PB I haven't required much in the way of external .DLLs as most of what I need is either native or there are support libs for.