PureBasic Docs- Ideas/Help needed for a "We start" chapter!?

Everything else that doesn't fall into one of the other PB categories.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by collectordave »

If there's flickering on any unintended gadget or window:

i. the event did not fall through

ii. it's the result of poor or faulty programming

iii. it's an error to be rectified; not an effect to be overcome
i. The event did fall through. That is one of the points.

ii. When you consider it all it is simply a result of an inaccuracy in the documentation. I presume the help file was not updated from PB version 2.1. It was noticed by error checking the programme correctly.

iii. The rectification of the error was suggested and rejected. Simply add two letters to the help file.

The above points can be easily gleaned from the topics where this has been done to death but just to reiterate the facts.

Before using EventWindow() you must check that a valid PB event has been received. How tocheck that a valid PB event has been recieved is up to the individual programmer. I would not presume to tell anyone how to do this.
But more importantly, PureBasic does not support mouse move events on windows. :lol:
That is also the point. The mouse move events on a window are not valid PureBasic events but are reported by WaitWindowEvent() etc. Keeping this in mind and actually reading the replies above show that there are situations where flickering can occur.

However everything said I agree with Little John
It seems to me that it's time again for cleaning this topic
As this is becoming very tiresome and detracts from what I am achieving.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
fromVB
User
User
Posts: 81
Joined: Sun Jul 29, 2012 2:27 am

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by fromVB »

collectordave wrote:
If there's flickering on any unintended gadget or window:

i. the event did not fall through

ii. it's the result of poor or faulty programming

iii. it's an error to be rectified; not an effect to be overcome
i. The event did fall through. That is one of the points.

ii. When you consider it all it is simply a result of an inaccuracy in the documentation. I presume the help file was not updated from PB version 2.1. It was noticed by error checking the programme correctly.

iii. The rectification of the error was suggested and rejected. Simply add two letters to the help file.

The above points can be easily gleaned from the topics where this has been done to death but just to reiterate the facts.

Before using EventWindow() you must check that a valid PB event has been received. How tocheck that a valid PB event has been recieved is up to the individual programmer. I would not presume to tell anyone how to do this.
But more importantly, PureBasic does not support mouse move events on windows. :lol:
That is also the point. The mouse move events on a window are not valid PureBasic events but are reported by WaitWindowEvent() etc. Keeping this in mind and actually reading the replies above show that there are situations where flickering can occur.

However everything said I agree with Little John
It seems to me that it's time again for cleaning this topic
As this is becoming very tiresome and detracts from what I am achieving.
I agree that it is good to check the events before sending to the window. But I do not underatnd the flickering part and I have not seen this before. Do you have a example to show this because it might be a bug.
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by TI-994A »

fromVB wrote:...I do not underatnd the flickering part and I have not seen this before. Do you have a example to show this because it might be a bug.
Here you go: > Multiple window problem

Buggy programming... buggy understanding... but no bug. :lol:

And no flickering either!
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
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by collectordave »

I agree that it is good to check the events before sending to the window. But I do not underatnd the flickering part and I have not seen this before. Do you have a example to show this because it might be a bug.
Not just good to check events but to check that the event is a valid PureBasic event before sending to the windows event handling procedure as EventWindow() is only valid after a valid PureBasic event not unsupported events.

Example of the flickering allready posted in the topic where this is discussed which was rejected.

It is not a bug it is simply a lack of detail in the help file and documentation. Probably the documentation was not updated after the WaitWindowEvent() procedure was changed to provide all window events at around PureBasic version 2.1 or thereabouts.

The returned value from EventWindow() is only valid after a valid PureBasic event is provided by WaitWindowEvent(). All that is needed is for the documentation to have two letters added to make it all clear, as posted before. Again this amendment\update has allready been posted for the documentation to be updated. So far rejected.
Last edited by collectordave on Mon Jan 04, 2016 7:56 pm, edited 1 time in total.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by collectordave »

Buggy programming... buggy understanding... but no bug. :lol:
I agree you do provide buggy programming as you have buggy understanding and of course there is no bug just the two missing letters from the documentation.:lol:
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
fromVB
User
User
Posts: 81
Joined: Sun Jul 29, 2012 2:27 am

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by fromVB »

collectordave wrote:
I agree that it is good to check the events before sending to the window. But I do not underatnd the flickering part and I have not seen this before. Do you have a example to show this because it might be a bug.
Not just good to check events but to check that the event is a valid PureBasic event before sending to the windows event handling procedure as EventWindow() is only valid after a valid PureBasic event not unsupported events.

Example of the flickering allready posted in the topic where this is discussed which was rejected.

It is not a bug it is simply a lack of detail in the help file and documentation. Probably the documentation was not updated after the WaitWindowEvent() procedure was changed to provide all window events at around PureBasic version 2.1 or thereabouts.

The returned value from EventWindow() is only valid after a valid PureBasic event is provided by WaitWindowEvent(). All that is needed is for the documentation to have two letters added to make it all clear, as posted before. Again this amendment\update has allready been posted for the documentation to be updated. So far rejected.
Thank you collectordave. What two letters? :oops:

You said that the example of the flickering already posted. The multiple windows problem that TI-994A linked?
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by TI-994A »

In light of the confusion caused by the misunderstanding and misuse of the EventWindow() function in recent posts, here's a simple example to demonstrate its use in a multi-window scenario:

Code: Select all

Enumeration Windows
  #Window1
  #Window2
  #Window3
EndEnumeration

Enumeration Gadgets
  #Button1a
  #Button1b
  #Button2
  #Button3
  #Text1a
  #Text1b
  #Text2
  #Text3
  #Label1
  #Label2
EndEnumeration

Enumeration Timers
  #Timer1
  #Timer2
  #Timer3
EndEnumeration

Procedure Open_Window2()
  wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
  OpenWindow(#Window2, #PB_Any, #PB_Any, 400, 200, "Window 2", wFlags)
  EditorGadget(#Text2, 10, 10, 380, 130)
  ButtonGadget(#Button2, 10, 150, 380, 40, "Close Window 2")
  AddWindowTimer(#Window2, #Timer2, 1000)
  ResizeWindow(#Window2, WindowX(#Window2) - (WindowWidth(#Window2) / 2) - 15, 
               #PB_Ignore, #PB_Ignore, #PB_Ignore)
  DisableGadget(#Button1a, 1)
  ProcedureReturn
EndProcedure 

Procedure Window2_EventHandler(event.i)
  Select event
    Case #PB_Event_CloseWindow
      windowClosed = #True
    Case #PB_Event_Timer
      SetWindowTitle(#Window2, 
                     "Window 2 - " + FormatDate("%hh:%ii:%ss", Date()))      
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Button2
          windowClosed = #True
        Case #Text2
          Select EventType()
            Case #PB_EventType_Focus
              SetGadgetText(#Text2, "")              
            Case #PB_EventType_Change
              SetGadgetText(#Text1a, GetGadgetText(#Text2))
          EndSelect
      EndSelect
  EndSelect
  
  If windowClosed
    DisableGadget(#Button1a, 0)
    RemoveWindowTimer(#Window2, #Timer2)
    CloseWindow(#Window2)
  EndIf
  
  ProcedureReturn
EndProcedure 

Procedure Open_Window3()
  wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
  OpenWindow(#Window3, #PB_Any, #PB_Any, 400, 200, "Window 3", wFlags)
  EditorGadget(#Text3, 10, 10, 380, 130)
  ButtonGadget(#Button3, 10, 150, 380, 40, "Close Window 3")
  AddWindowTimer(#Window3, #Timer3, 1000)
  ResizeWindow(#Window3, WindowX(#Window3) + (WindowWidth(#Window3) / 2) + 15, 
               #PB_Ignore, #PB_Ignore, #PB_Ignore)
  DisableGadget(#Button1b, 1)
  ProcedureReturn
EndProcedure 

Procedure Window3_EventHandler(event.i)
  Select event
    Case #PB_Event_CloseWindow
      windowClosed = #True
    Case #PB_Event_Timer
      SetWindowTitle(#Window3, 
                     "Window 3 - " + FormatDate("%hh:%ii:%ss", Date()))
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Button3
          windowClosed = #True
        Case #Text3
          Select EventType()
            Case #PB_EventType_Focus
              SetGadgetText(#Text3, "")              
            Case #PB_EventType_Change
              SetGadgetText(#Text1b, GetGadgetText(#Text3))
          EndSelect
      EndSelect
  EndSelect
  
  If windowClosed
    DisableGadget(#Button1b, 0)
    RemoveWindowTimer(#Window3, #Timer3)
    CloseWindow(#Window3)
  EndIf
  
  ProcedureReturn
EndProcedure 

wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
OpenWindow(#Window1, #PB_Any, #PB_Any, 400, 250, "A Multi-Window Example", wFlags)
TextGadget(#Label1, 10, 10, 200, 20, "Window 2 mirror:")
TextGadget(#Label2, 10, 105, 200, 20, "Window 3 mirror:")
EditorGadget(#Text1a, 10, 30, 380, 65, #PB_Editor_WordWrap)
EditorGadget(#Text1b, 10, 125, 380, 65, #PB_Editor_WordWrap)
ButtonGadget(#Button1a, 10, 200, 185, 40, "Open Window 2")
ButtonGadget(#Button1b, 205, 200, 185, 40, "Open Window 3")
AddWindowTimer(#Window1, #Timer1, 1000)
ResizeWindow(#Window1, #PB_Ignore, WindowY(#Window1) - WindowHeight(#Window1) - 30,
             #PB_Ignore, #PB_Ignore)
Repeat
  event = WaitWindowEvent()
  Select EventWindow()
    Case #Window2
      Window2_EventHandler(event)
    Case #Window3
      Window3_EventHandler(event)
    Case #Window1
      Select event
        Case #PB_Event_CloseWindow
          appQuit = 1
        Case #PB_Event_Timer
          SetWindowTitle(#Window1, "A Multi-Window Example - " + 
                                   FormatDate("%hh:%ii:%ss", Date()))          
        Case #PB_Event_Gadget
          Select EventGadget()
            Case #Button1a
              If Not IsWindow(#Window2)
                Open_Window2()
              EndIf
            Case #Button1b
              If Not IsWindow(#Window3)
                Open_Window3()
              EndIf
            Case #Text1a
              Select EventType()
                Case #PB_EventType_Focus
                  SetGadgetText(#Text1a, "")
                Case #PB_EventType_Change  
                  If IsGadget(#Text2)
                    SetGadgetText(#Text2, GetGadgetText(#Text1a))   
                  EndIf
              EndSelect
            Case #Text1B
              Select EventType()
                Case #PB_EventType_Focus
                  SetGadgetText(#Text1b, "")
                Case #PB_EventType_Change  
                  If IsGadget(#Text3)
                    SetGadgetText(#Text3, GetGadgetText(#Text1b))   
                  EndIf
              EndSelect
          EndSelect
      EndSelect
  EndSelect    
Until appQuit = 1
Each window's events are handled exclusively by its own event handler, working gracefully without any issues.

No crossfires. No misfires. Just the simple beauty of PureBasic! :wink:
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
newtheogott
Enthusiast
Enthusiast
Posts: 120
Joined: Sat Apr 26, 2003 2:52 pm
Location: Germany, Karlsruhe
Contact:

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by newtheogott »

Yes that is an important point.
How many PureBasic users come from "nothing" and how many switch to PureBasic from "Another language"?
Coming from another language, there is another tutorial needed then a genreal tutirla for programmers.

The multiple window problem is really one of the things that beats (us) these people first.
And i think this is not necessary the case but due to some design flaws in the manual and the Visual designer.

Many languages work "SDK based" so the question for them is "How do i code the Message Loop for multiple forms in PureBasic"?
--Theo Gottwald
-----------------------------------------
http://www.it-berater.org * http://www.fa2.de * http://www.smart-package.com
User avatar
spikey
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by spikey »

newtheogott wrote:Yes that is an important point.
And i think this is not necessary the case but due to some design flaws in the manual and the Visual designer.
I have to disagree here (and not solely because I've contributed to some of the documentation!).

The failure to get things right in newbies often stems from failure to read and understand the documentation properly - however, unlike some other forums, most people here don't respond with a rude "RTFM" type response but try to answer the question in a useful form. Don't forget that the forum is part of the documentation - and in fact in many ways is far more useful because of its interactive element.
I keep six honest serving-men
(They taught me all I knew);
Their names are What and Why and When
And How and Where and Who.
Last edited by spikey on Sat Feb 20, 2016 7:19 pm, edited 1 time in total.
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by TI-994A »

newtheogott wrote:How many PureBasic users come from "nothing" and how many switch to PureBasic from "Another language"? Coming from another language, there is another tutorial needed then a genreal tutirla for programmers.

...but due to some design flaws in the manual and the Visual designer.
While some may indeed be virgin coders, a fair share would have migrated from some other languages. I myself remember looking for C programming books for BASIC programmers.

However, it would not be practical to have sections for every conceivable language; and unless there is a substantial number of good PureBasic programmers that have migrated from those languages, such sections wouldn't be productive either.

And based on your posts on the topic, there clearly aren't any flaws with the form designer; only flawed concepts and approaches based on experiences and expectations from other languages.

The mistake is trying to learn PureBasic by drawing parallels with those other languages; the right approach would be to learn PureBasic. :wink:
newtheogott wrote:"How do i code the Message Loop for multiple forms in PureBasic"?
> UserGuide - Managing multiple windows
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
newtheogott
Enthusiast
Enthusiast
Posts: 120
Joined: Sat Apr 26, 2003 2:52 pm
Location: Germany, Karlsruhe
Contact:

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by newtheogott »

I have started to look this tutorial, its also a good start.

Forms Designer.
Coming from elsewhere, the PureBasic Forms Designer ist not up to Standards but a free "Addon" and for that its free, its Ok.
Compared with really good Code generators it would need a refresh as i see it (ok, if you use it any day and you are used to its design flaws, then you might have another opinion).

Also I have taken a look on this tutorial.
https://www.youtube.com/watch?v=_Zb8gFIwzpg
--Theo Gottwald
-----------------------------------------
http://www.it-berater.org * http://www.fa2.de * http://www.smart-package.com
NaomiSloan
New User
New User
Posts: 3
Joined: Tue Aug 13, 2019 11:49 pm

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by NaomiSloan »

Hello!

One thing that would really help a newcomer as well as a "We start" page is a "Where to Find" page.

PureBasic has probably documented everything needed but it does not seem all that intuitive and things are not always where you might expect them to be.

So perhaps a page that re-indexes things, re-categorises headings and links to relevant pages, would help. For example, constants - where can you find what constants are available, so that things like #CR$ and so on are not discovered only by stumbling across their use in source code.

Just a thought from someone trying to wade through the docs at the moment.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by collectordave »

NaomiSloan wrote: For example, constants - where can you find what constants are available, so that things like #CR$ and so on are not discovered only by stumbling across their use in source code.
I agree still not used to finding them a simple list in the docs maybe it is allready there.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
User avatar
Demivec
Addict
Addict
Posts: 4086
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by Demivec »

NaomiSloan wrote: For example, constants - where can you find what constants are available, so that things like #CR$ and so on are not discovered only by stumbling across their use in source code.
I agree with the idea about a variety index of sorts. As to things related to constants, here is an Overview of PureBasic Constants.
User avatar
StPaul
User
User
Posts: 20
Joined: Fri Jan 08, 2010 2:30 am
Location: Oregon USA
Contact:

Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt

Post by StPaul »

Andre, Its been a few years & I am not sure you will see this but I am hopeful. The We Start chapter is very good. And I think I may have a use for it. Maybe.

I have been away from PureBasic for a few years for various reasons. I have been programming in Python but I really like PureBasic a great deal. I downloaded the latest PureBasic update last week. I am not sure what other computer game tools have been invented since I was away. I would guess that PureBasic is still fairly competitive (I have not looked at Spider yet).

My daughter’s high school has a “computer game programming class”. I met with the teacher today & told him about PureBasic. Likely, he will "down load" a demonstration for evaluation. Even if he does not use it in class, he suggested I find a good demo, or create something that I can bring into his class for a demonstration. He is very open to his students looking at different tools and languages.

I think it would be great if we could get some interest here in Tillamook. Personally, I have always thought PureBasic was great. Its a lot more fun to use than anything else I have tried. And the PureBasic team and Forum participants all seem to be really positive folks. That is one of the things I enjoyed most.


Wishing you well, even it this message never reaches you.

St. Paul
[img]StPaul.jpg/img]
Post Reply