The translation is completed


... so we likely gonna have a triple-languaged-PB-UGuide soon
Yes that would be nice.Andre wrote:And maybe there are some more ideas/contributions for new chapters, which should be included in the beginners sections!?
Based on this little excerpt from that tutorial, some words of caution for the newbies:collectordave wrote:...wrote a little tutorial of my own.
http://www.codeinbasic.com/index.php?topic=260.0
Hope all newbies enjoy
While this may not be evident in the size of the compiled binary, it could be clearly seen in the memory footprint that the executable occupies; simply assigning a large static object number would increase the memory usage by 100Kb.PureBasic Manual wrote:Indexed numbering
The static, indexed way, allows you to reference an object by a predefined numeric value. The first available index number is 0 and subsequent indexes are allocated sequentially. This means that if you use the number 0 and then the number 1000, 1001 indexes will be allocated and 999 (from 1 to 999) will be unused, which is not an efficient way to use indexed objects. If you need a more flexible method, use the dynamic way of allocating objects...
I abandoned using enumerations and assigning my own numbers to windows and gadgets in favour of assigning the allocated object number to variables for use later down the line. This can also become a pain trying to invent variable names for all the allocated object numbers so also started to use the module feature of PB to keep variable names isolated. Just imagine using five windows, each with Ok and Cancel buttons. Using modules you can use btnOk and btnCancel as variables for each and all the Ok and Cancel buttons on all windows no need to think of btnOk1,btnOk2 etc. This is explained in the tutorial.Furthermore, it should be noted that when utilising dynamic object numbering, the allocated object number should be assigned to a variable, as it would invariably be required further down the execution.
Code: Select all
hFile1 = CreateFile(0, "file1.tmp") <-- Process memory=1,756kb
hFile2 = CreateFile(50000000, "file2.tmp") <-- Process memory=197,492kb = 4 bytes reserved for each handle in the array on my Win32 (double that for handles on 64?)
I have absolutely no idea what you mean, but I was referring to this (the second highlighted block):collectordave wrote:I abandoned using enumerations and assigning my own numbers to windows and gadgets in favour of assigning the allocated object number to variables for use later down the line. This can also become a pain trying to invent variable names for all the allocated object numbers so also started to use the module feature of PB to keep variable names isolated. Just imagine using five windows, each with Ok and Cancel buttons. Using modules you can use btnOk and btnCancel as variables for each and all the Ok and Cancel buttons on all windows no need to think of btnOk1,btnOk2 etc. This is explained in the tutorial.TI-994A wrote:Furthermore, it should be noted that when utilising dynamic object numbering, the allocated object number should be assigned to a variable, as it would invariably be required further down the execution.
Code: Select all
winNumber = OpenWindow(#PB_Any, 0, 0, 270, 280, "Fruit & Veg", #PB_Window_SystemMenu)
That is correct and as you read through the tutorial chapters that is also explained.Without the variable, winNumber, there's no way to refer to the window after it is initialised.
Code: Select all
#Window_0 = 4800 ;~~~~~ Main Program Window
wFlags = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered
WinX = 0 : WinY = 0 : WinWidth = 1028 : WinHeight = 740
OpenWindow(#Window_0, WinX, WinY, WinWidth, WinHeight, "", wFlags )
Although you could technically use large numbers as object identifiers, it simply isn't recommended.VB6_to_PBx wrote:TI-994A ,
would my Code below be OK to use ?? ... any problems with it ??Code: Select all
#Window_0 = 4800
You answered that yourself!#Window_0 = 4800