Program Layout

Just starting out? Need help? Post your questions and find answers here.
Hot Pockets
User
User
Posts: 51
Joined: Mon Jun 01, 2009 3:56 am

Why doesn't this work

Post by Hot Pockets »

NetMaestro
Thank you for those encouraging words. My brief stay in the realm of PB
was well worth it just to meet such a nice and pleasant person as you!
I think I'm going to try free basic. I looked at their code reference and it seems(operative word) that it is very similar to Basic PDS 7.11. Again, thanks for your kindness!! :D
User avatar
John Puccio
User
User
Posts: 26
Joined: Fri Jun 12, 2009 6:56 am
Location: My Keyboard

Re: Why won't it run?

Post by John Puccio »

Hot Pockets wrote:My sincere apology to Mr Gaman. I overlooked the fact that My program lost its indentation because I saved it as Text. If I would of known how great Tags were I would of used them,(Great idea!)
Trend:
Thanks for setting me straight. I have already downloaded that book and printed all 350 Pages. Now I gusess it will end up in the dumper along with the money I spent buying PB.I don't think I'll ever be able to learn
PB. It is far more complicated from my point of view then Dark Basic or
Blitz Basic or Visual Basic 4. The only thing I almost learned that had almost as many constants was Ibasic. Again I am not really a programer. I wrote 1 very large Check register program in MS Basic7.11 That works well for me and I've been trying to re=write it for windows. Hah!! I doubt I'll ever suceed I am 80 years old, you never know tho, my health is good. Thanks for all your help!! :wink:
No don't give up, it's really not that hard to learn. I never stress over learning a new language. I just roll up my sleves and get my hands dirty. It all makes sense after a while. Did you fix your program? Is this what you were trying to do?

Code: Select all

Declare MainMenu(Width, Height)


LoadImage(0, "C:\test.bmp")
OpenWindow(0, 0, 0, ImageWidth(0), ImageHeight(0), "Command", #PB_Window_BorderLess | #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
  ImageGadget(0, 0, 0, 0, 0, ImageID(0))
  Delay(2000)
CloseWindow(0) 

MainMenu(ImageWidth(0), ImageHeight(0))

Procedure MainMenu(Width, Height) 
  OpenWindow(1, 0, 0, Width, Height, "Command", #PB_Window_ScreenCentered | #PB_Window_SystemMenu) 

  If CreateMenu(1, WindowID(1))
    MenuTitle("File") 
    MenuItem( 1, "&Load...") 
    MenuItem( 2, "Save") 
    MenuItem( 3, "Save As...") 
    MenuBar() 
   
    OpenSubMenu("Recents") 
      MenuItem( 5, "Pure.png") 
      MenuItem( 6, "Basic.jpg") 
   
      OpenSubMenu("Even more !") 
        MenuItem( 12, "Yeah") 
      CloseSubMenu() 
   
      MenuItem( 13, "Rocks.tga") 
    CloseSubMenu() 
   
    MenuBar() 
    MenuItem( 7, "&Quit") 

    MenuTitle("Edition") 
    MenuItem( 8, "Cut") 
    MenuItem( 9, "Copy") 
    MenuItem(10, "Paste") 
      
    MenuTitle("?") 
    MenuItem(11, "About") 
  EndIf 
  
  DisableMenuItem(1, 3, 1) 
  DisableMenuItem(1, 13, 1) 
  ; This is the 'event loop'. All the user actions are processed here. 
  Repeat 

    Select WaitWindowEvent() 
      Case #PB_Event_Menu 
        Select EventMenu()  ; To see which menu has been selected 
          Case 11 ; About 
            MessageRequester("About", "Cool Menu example", 0) 
          Default 
            MessageRequester("Info", "MenuItem: "+Str(EventMenu()), 0) 
        EndSelect 
      Case #PB_Event_CloseWindow 
        Break 
    EndSelect
     
  ForEver 
EndProcedure 

srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Blitz Basic or Visual Basic 4. The only thing I almost learned that had almost as many constants was Ibasic...
Uhm, you looked at VB lately? You do seem to flit between a lot of basic's and, well, appear happy with none of them! What is it you are after exactly?

As for Freebasic; I find that creating applications is far slower with this development tool than with Purebasic. It simply doesn't have the wealth of user-libraries that we have here which make application prototyping so easy and fast.

But, well, when all is said and done, it is 'horses for courses'. The only thing I can suggest is that you perhaps be a little more patient and do not expect to become a master within a matter of weeks. My complete idiocy (and lunacy) was honed over many years and I learn something new every day! :wink:
I may look like a mule, but I'm not a complete ass.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

It is far more complicated from my point of view then Dark Basic or
Blitz Basic or Visual Basic 4.
Most people that find PB difficult find it difficult because they assume it works like other products. In reality, PB is one of the simplest basics when it comes to the number of concepts you have learn. There's about two things to it:

1. Each line runs in succession, one after the other. They don't run at the same time or continue with the next line before the current line is done.
2. Except for loops, the lines inside a loop may run several times, but each line runs in succession.
3. Except for Procedures, which run when they are Called(). The program runs the procedure until it ends, then continues to run the program from after the procedure was called.

Stop thinking complicated.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

Trond wrote:1.
2.
3.
... and this is "the nature of procedural programming"

with VB, it's a completely different thing, because you associate codesnippets to objects and events.
oh... and have a nice day.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

with VB, it's a completely different thing, because you associate codesnippets to objects and events
Only because that's the way it's presented in the Visual Studio IDE. You can easily do the same in PB by subclassing the controls and leaving your main loop simple. Then the code for every event is organized and located logically. I made a subclass tool for the PB IDE and using that it all gets set up automatically. I just have to add events to each skeleton as appropriate, if needed. This is exactly what happens when you use the VB IDE to click on a listed event and type in the code snippet for it. The thing to love about PureBasic is that it can be almost anything you want it to be.
BERESHEIT
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

but you need to know how to do it.

natively you have to think completely the other way round than in VB.
oh... and have a nice day.
rrpl
Enthusiast
Enthusiast
Posts: 121
Joined: Fri Apr 18, 2008 7:22 am
Location: Australia

Post by rrpl »

I don't think I'll ever be able to learn
PB. It is far more complicated from my point of view then Dark Basic or
Blitz Basic or Visual Basic 4. The only thing I almost learned that had almost as many constants was Ibasic. Again I am not really a programer. I wrote 1 very large Check register program in MS Basic7.11 That works well for me and I've been trying to re=write it for windows. Hah!! I doubt I'll ever suceed I am 80 years old, you never know tho, my health is good. Thanks for all your help!!
I think I have got to weigh in here. The easiest way to learn PB I think is to start off with a few simple command line programs, then a basic window project (you can use examples in the PB Archive to start on, but rewrite them yourself). Then having learnt the way PB works I think you'll find it one of the easiest languages around.

I have tried numerous other languages including Dark Basic (good for gaming), VB, free basic, and many other non basic languages, but PB just clicks with me and many others for that matter. Of course as 'srod' said:
when all is said and done, it is 'horses for courses'
This is very true. A lot depends upon what you want to program. Some times a couple of different languages may be needed to get the end result.
Hot Pockets
User
User
Posts: 51
Joined: Mon Jun 01, 2009 3:56 am

Program Layout

Post by Hot Pockets »

Thanks for all the words of encouragement. I Finished My Menu,and My bitmap now works with The proper titles in the proper places. With a lot of Help!! I am definitely going to forgo trying to use the visual designer I guess I'll just try to stumble around and learn a little bit at a Time.(I'm good at stumbling around)
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

HotPocket, did you check out Kale's book and the Survival Guide?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

I'm trying to re-write a check register program that I wrote for dos years ago.
If this is you, what compiler did you use to write this program?


Check out this one
Or see if you can find a compiler here
Hot Pockets
User
User
Posts: 51
Joined: Mon Jun 01, 2009 3:56 am

Layout's

Post by Hot Pockets »

I printed out the survival guide and Gary Wiloughby's Beginners Pure Basic Guide. The compiler I used to compile the Original Check Chum Register program was MSN's Basic PDS 7.11. Free basic is perhaps the closest to it. But PureBasic has more commands. And now that I see what is possible it interest's me. So I just may stick around a while. Thanks for the help!!
Post Reply