Should PureBasic become my main development system?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Should PureBasic become my main development system?

Post by Caronte3D »

For me, the best IDE (even better that VB6) was the Delphi one 8)
User avatar
the.weavster
Addict
Addict
Posts: 1536
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Re: Should PureBasic become my main development system?

Post by the.weavster »

radsoft wrote: Wed Sep 14, 2022 3:51 am I'm drawn to PureBasic by everything it offers and I think my main concern now is how I'll be able to develop an application with multiple windows in a timely way.
It's been a while since I did anything involving PB gadgets (recently I've tended to make application servers with an HTML ui) but this skeleton shows how I liked to layout code for apps with multiple windows:

Code: Select all

Enumeration windows
  #frmMain
  #frmChild
EndEnumeration

Enumeration gadgets
  #frmMain_btnChild
  #frmChild_btnOK
EndEnumeration

; child window - definition and handlers could be in separate file(s)
Procedure frmChild_Open()
  If OpenWindow(#frmChild, 0, 0, 200, 150, "child", #PB_Window_SystemMenu|#PB_Window_WindowCentered)
    ButtonGadget(#frmChild_btnOK, 10, 10, 150, 30, "Show Message")
  EndIf
EndProcedure

; child window's gadget handlers
Procedure frmChild_onGadget(nGadget, nEventType, nX, nY)
  Select nGadget
    Case #frmChild_btnOK
      MessageRequester("", "Hello, World!", 0)
  EndSelect
EndProcedure

; app's main window
Procedure frmMain_Open()
  If OpenWindow(#frmMain, 0, 0, 400, 300, "parent", #PB_Window_ScreenCentered)
    ButtonGadget(#frmMain_btnChild, 10, 10, 150, 30, "Show Child")
  EndIf  
EndProcedure

; main window's gadget handlers
Procedure frmMain_onGadget(nGadget, nEventType, nX, nY)
  Select nGadget
    Case #frmMain_btnChild
      frmChild_Open()
  EndSelect
EndProcedure

; gadget events - routing to relevant window
Procedure Events_Gadget()
  nGadget = EventGadget()
  nEventType = EventType()
  nX = 0 : nY = 0
  Select GadgetType(nGadget)
    Case #PB_GadgetType_Canvas
      nX = GetGadgetAttribute(nGadget, #PB_Canvas_MouseX)
      nY = GetGadgetAttribute(nGadget, #PB_Canvas_MouseY)
    Case #PB_GadgetType_ListIcon
      nY = GetGadgetState(nGadget)
    ; etc...
  EndSelect
  Select EventWindow()
    Case #frmMain
      frmMain_onGadget(nGadget, nEventType, nX, nY)
    Case #frmChild
      frmChild_onGadget(nGadget, nEventType, nX, nY)
  EndSelect
EndProcedure

; windows' close events
Procedure Events_CloseWindow()
  nWin = EventWindow()
  Select nWin
    Case #frmMain
      End ; closing main window quits app
    Default
      CloseWindow(nWin)
  EndSelect  
EndProcedure

BindEvent(#PB_Event_Gadget, @Events_Gadget())
BindEvent(#PB_Event_CloseWindow, @Events_CloseWindow())

frmMain_Open()
Repeat
  nWait = WaitWindowEvent()
ForEver
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Should PureBasic become my main development system?

Post by Caronte3D »

the.weavster wrote: Thu Sep 22, 2022 6:58 pm It's been a while since I did anything involving PB gadgets (recently I've tended to make application servers with an HTML ui) but this skeleton shows how I liked to layout code for apps with multiple windows:
Nice and clean, thaks for sharing :wink:

BTW: I'd love to see a simple example of how you use PB on the server side with an html front-end :wink:
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Should PureBasic become my main development system?

Post by infratec »

We just decided to use the react framework for our SIP software written in PB.
The website is started in kiosk mode and it communicates via websocket.

Works very well.
radsoft
User
User
Posts: 25
Joined: Mon Sep 11, 2017 2:03 am
Location: New Zealand

Re: Should PureBasic become my main development system?

Post by radsoft »

Hi there Yogi Yang, I have looked at Twinbasic previously and it looks to have great potential but I wouldn't enter into the subscription model.

Thanks the.weavster for your skeleton code, it is very useful for me, thank you.

Caronte3D, I also enjoyed Delphi. I think from memory, I paid about US$112 for version 1 and the last I purchased was version 7. The price has increased a lot but we have Lazarus Pascal so we're okay.
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Should PureBasic become my main development system?

Post by TI-994A »

radsoft wrote: Fri Sep 09, 2022 10:55 am... It was the events handling tutorial by TI-994A that got me on a new path to gaining success with PureBasic, thank you TI-994A.
Hi David. Thank you for saying so. I'm glad you found it helpful. :D

Since you mentioned that your focus would be on database applications, here's a quick guide for SQLite:

> PureBasic SQLite Database: A Quick Tutorial
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
chikega
User
User
Posts: 34
Joined: Fri Dec 04, 2020 3:19 am

Re: Should PureBasic become my main development system?

Post by chikega »

Yes, Yogi. I played with it some. It appears well integrated with Visual Code. There's also RadBasic which is supposedly 100% compatible with VB6 projects. But it also unfortunately appears to have a subscription (Patreon) model as well.
Gary E Chike DMD MS
'Experience is what you get when you don't get what you want' Image
radsoft
User
User
Posts: 25
Joined: Mon Sep 11, 2017 2:03 am
Location: New Zealand

Re: Should PureBasic become my main development system?

Post by radsoft »

Hello TI-994A and yes, I've already been using your excellent SQLite tutorial, thank you. It is another of your tutorials that made it possible for me to get going with PureBasic.

My ambitions with PureBasic have escalated much faster than my learning and I'm very pleased with my IceDesign purchase but coming back to reality, the way forward for me is to remain hand coding single-window applications for a while to better learn some of the terminology and then I'll be able to ask questions more intelligently.

David
Post Reply