Some beginner's questions

Everything else that doesn't fall into one of the other PB categories.
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Some beginner's questions

Post by jacdelad »

Hello,
I started PureBasic a year ago and of course consider myself still a beginner. Over time some questions popped up and I want to ask them now (I don't want to open a separate thread for each one):

1. Why does Define/Global/... use NewList/NewMap and Structure use List/Map? Wouldn't it be easier if both used the same keyword?
2. Reading in the forum it seems like #PB_EventType_RightClick was removed for buttons some time ago (or it never existed). I am used to use Windows APIs and can get the same behaviour with #WM_RBUTTONUP and it's not like it's hard to use. Anyway, thinking of portability (and also why not?), why is there not #PB_EventType_RightClick for buttons (and some other gadgets)? Also, I can only speak for Windows since I'm only using Windows.
3. Why is EnableExplicit not enabled by default? I for one am using it in every project (and it seems like everyone else does too) for obvious reasons. I only use DisableExplicit (not really, I just don't enable it) when I try a short piece of code from the forum or something similar. In my opinion EnableExplicit should be enabled by default.
4. Why is PureBasic not using the regular handles for gadgets/windows? Every other programming language i learned uses the handles (again, I only do Windows).
5. It looks like CEGUI is abandoned. So, from my point of view, wen don't need the Window3D library anymore. Or am I wrong?
6. OpenSubMenu() does not return anything and it doesn't get an ID (though Windows allows/needs that). With an ID I can disable/enable it afterwards and whatever. I guess there's no way beside using Windows API for creating a submenu with ID for later manipulation?
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: Some beginner's questions

Post by Mijikai »

1. if there is a way to make it work
2. dont know, i dont really use the input sheme from pb
3. good question it should be rather DisableExplicit
4. there is a spreadsheet somehwere showing os related handles and stuff - usually xxxID() will give back a os handle.
5. the whole 3d lib should be replaced imho
6. it should return something on windows os at least according to the remark in the help file
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: Some beginner's questions

Post by jacdelad »

Hello Mijikai,
thanks for your answer. Unfortunately,
1. This doesn't answer my question.
2. This too...
3. That's what I meant. DisableExplicit is already available, this should be standard.
4. I know how to do it, I just wonder why PureBasic goes a different way than every other programming language I know.
5. I guess that's easier said than done. I'm also not the one who demands anything, I just want to understand.
6. Yes, I know the Windows API do what I want. That's why I ask why PureBasic doesn't. And I know, I can always use the APIs.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Some beginner's questions

Post by STARGÅTE »

I can answer just some of these questions:
jacdelad wrote: Thu Aug 12, 2021 6:53 pm 1. Why does Define/Global/... use NewList/NewMap and Structure use List/Map? Wouldn't it be easier if both used the same keyword?
This is a historical distinction. Before PureBasic 4.00 it was only possible to define arrays (Dim, comparable to very old basics) and lists (NewList) and as a global variable. It was not possible to use them static or protected nor in structures. Therefore you just uses NewList to create a new (global) list or Dim to create a new (global) array. You can also ask here, why Dim is not called NewArray: also a historical evolution.
With PB 4.00 you were able to use also the keywords Global, Protected, Static and Shared for arrays and lists. At this point you can rename NewList to List because now you have to write: Define List or Global List etc. But many codes would then be incompatible. With PB 4.50 the support for Array, List, Map inside structures was available. But different to global or protected lists or arrays they are only present, when the structure is used. This differ them to NewList or NewMap, which is immediately present. I think that is another reason, why there are still two types of keywords.
jacdelad wrote: Thu Aug 12, 2021 6:53 pm 4. Why is PureBasic not using the regular handles for gadgets/windows? Every other programming language i learned uses the handles (again, I only do Windows).
The question is "regular handles" as what? A return value for OpenWindow() or CreateXxxGadget()? As an input parameter for Sets and Gets like GadgetX(), SetGadgetState() ... ? The reson is, PureBasic uses auto-generated window or gadget numbers (#PB_Any) or index-based numbers like 1, 2 or 647. This is not possible when you strictly use the regular handles.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: Some beginner's questions

Post by jacdelad »

Aha, that indeed clears some things up.

I already suspected it to be some kind of historical development. Fred could also have used NewList in structures, but ok, it is how it is. And compatibility is always good, especially for beginners who find old, but working code in the forum.

I never use fixed IDs so I'm used to the handles that are usually returned (by Windows APIs, like CreateWindow_()). I know that every window or gadget (or control in case of plain Windows) also has an ID (which can be fixed, like in resources). But as I said, I never used that. But it makes sense and while working without API calls it doesn't matter.

Thanks.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Post Reply