Updated Code indentation
Posted: Tue Apr 15, 2014 2:28 am
I don't know the extent to which how many internal PB commands are like this, but some PB commands are not setup for indentation, even though in example code they are written as such. I know sometimes I find it a pain in the ass to have to go back and manually indent stuff, and I think given they are internal commands, the IDE's indentation rules should be setup to include them by default..
Just to give an example, from the Help documentation (and I don't know if this is a special case because they are gadget calls, but) --
This looks nice and is easy to read but if you were to manually type this code in, none of it would self-indent save for the If/EndIf block
I think that Gadgets (and other commands) where at least, you are specifically calling other commands that specifically apply to the previous command's generated results (ie AddGadgetItem implcitly adds the Gadget to the PanelGadget called above it) should definitely get indentation by default.
It's a pain to manually indent because when you hit Enter, the line immediately resets.. I'm aware we can enable a mode where it won't do this, but then IIRC you lose pretty much all auto-indentation as a result? meaning you'd have to take care to manually indent / reverse everything as you went. Which is also a pain
Just to give an example, from the Help documentation (and I don't know if this is a special case because they are gadget calls, but) --
Code: Select all
If OpenWindow(0, 0, 0, 322, 220, "PanelGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PanelGadget (0, 8, 8, 306, 203)
AddGadgetItem (0, -1, "Panel 1")
PanelGadget (1, 5, 5, 290, 166)
AddGadgetItem(1, -1, "Sub-Panel 1")
AddGadgetItem(1, -1, "Sub-Panel 2")
AddGadgetItem(1, -1, "Sub-Panel 3")
CloseGadgetList()
AddGadgetItem (0, -1,"Panel 2")
ButtonGadget(2, 10, 15, 80, 24,"Button 1")
ButtonGadget(3, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
I think that Gadgets (and other commands) where at least, you are specifically calling other commands that specifically apply to the previous command's generated results (ie AddGadgetItem implcitly adds the Gadget to the PanelGadget called above it) should definitely get indentation by default.
It's a pain to manually indent because when you hit Enter, the line immediately resets.. I'm aware we can enable a mode where it won't do this, but then IIRC you lose pretty much all auto-indentation as a result? meaning you'd have to take care to manually indent / reverse everything as you went. Which is also a pain