Rename ProcedureReturn to Return
Rename ProcedureReturn to Return
Hi,
i would like ProcedureReturn renamed to Return, because i guess it is very more often used than the Return command. We would save 9 characters for each use and cleanup the source a little bit. Return could be renamed to GosubReturn. All existing projects could be easily adapted by a simple search/replace. Also Return is more common in Basic languages. ProcedureReturn could remain for compatibility issues.
Best regards
Uwe
i would like ProcedureReturn renamed to Return, because i guess it is very more often used than the Return command. We would save 9 characters for each use and cleanup the source a little bit. Return could be renamed to GosubReturn. All existing projects could be easily adapted by a simple search/replace. Also Return is more common in Basic languages. ProcedureReturn could remain for compatibility issues.
Best regards
Uwe
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
Re: Rename ProcedureReturn to Return
I'd be in favor of this too, but in fact I don't care so much anyway.
I tweaked PB a little using macros in residents, so this is not an issue for me anymore (I use 'yield' instead of ProcedureReturn).
I tweaked PB a little using macros in residents, so this is not an issue for me anymore (I use 'yield' instead of ProcedureReturn).
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
-
- Enthusiast
- Posts: 542
- Joined: Tue Apr 24, 2012 5:08 pm
- Location: Ontario, Canada
Re: Rename ProcedureReturn to Return
I've been using Gosub/Return since 1965 - please don't make me change now.uwekel wrote:i would like ProcedureReturn renamed to Return

This has to be the silliest request since the "ComeFrom" statement was invented. But if the number of ProcedureReturn statements is creating a problem for you, try using the following macro:
Code: Select all
Macro XXX ()
ProcedureReturn
EndMacro
By the way, I prefer long names and lots of typing.

Code: Select all
;===============================================
;
; objMenu.pbi : class interface : Menu Class
;
;-----------------------------------------------
;
DeclareExternalFunction(Menu, Create, typObject) ()
;
Interface objMenu
;
; primary methods
;
Func(Destroy, typObject) ()
Func(Clone, typObject) ()
Func(Class, typInt32) ()
Getx(exiChildEntryNumber, typInt32) ()
Setx(exiChildEntryNumber) (ByVal(bviChildEntryNumber, typInt32))
;
; external methods
;
Subr(Events) ()
Subr(Resize) ()
Subr(Attach) ()
Subr(AttachChild) (ByVal(bvoChild, typObject))
Subr(Detach) ()
Subr(DetachChild) (ByVal(bvoChild, typObject))
;
; external properties: read/write
;
;
; external properties: read only
;
Getx(exiGadgetNumber, typInt32) ()
Getx(exiActualLeft, typInt32) ()
Getx(exiActualTop, typInt32) ()
Getx(exiActualWidth, typInt32) ()
Getx(exiActualHeight, typInt32) ()
;
; external properties: write only
;
Setx(exiForegroundColour) (ByVal(bviForegroundColour, typInt32))
Setx(exiBackgroundColour) (ByVal(bviBackgroundColour, typInt32))
Setx(expCBDesign) (ByVal(bviIndex, typInt32), ByVal(bvpCBDesign, typPointer))
Setx(exoParent) (ByVal(bvoParent, typObject))
Setx(exiMarginTop) (ByVal(bviMarginTop, typInt32))
Setx(exiMarginBottom) (ByVal(bviMarginBottom, typInt32))
Setx(exiMarginLeft) (ByVal(bviMarginLeft, typInt32))
Setx(exiMarginRight) (ByVal(bviMarginRight, typInt32))
Setx(exlResizeAllowed) (ByVal(bvlResizeAllowed, typBoolean))
Setx(exlShrinkAllowed) (ByVal(bvlShrinkAllowed, typBoolean))
Setx(exiHorizontalAlignmentMode) (ByVal(bviHorizontalAlignmentMode, typInt32))
Setx(exlHorizontalAlignment) (ByVal(bvlHorizontalAlignment, typBoolean))
Setx(exiVerticalAlignmentMode) (ByVal(bviVerticalAlignmentMode, typInt32))
Setx(exlVerticalAlignment) (ByVal(bvlVerticalAlignment, typBoolean))
Setx(exiBaseLeft) (ByVal(bviBaseLeft, typInt32))
Setx(exiBaseTop) (ByVal(bviBaseTop, typInt32))
Setx(exiBaseWidth) (ByVal(bviBaseWidth, typInt32))
Setx(exiBaseHeight) (ByVal(bviBaseHeight, typInt32))
Setx(exsToolTip) (ByVal(bvsToolTip, typString))
Setx(exlShowSelection) (ByVal(bvlShowSelection, typBoolean))
Setx(exlHideNodeLines) (ByVal(bvlHideNodeLines, typBoolean))
Setx(exlHideNodeButtons) (ByVal(bvlHideNodeButtons, typBoolean))
Setx(exlShowCheckboxes) (ByVal(bvlShowCheckboxes, typBoolean))
;
EndInterface
;
;===============================================
; end of : objMenu.pbi
;===============================================
;===============================================
;
; clsMenu.pbi : class methods : Menu Class
;
;===============================================
;
; Properties
;
Structure strMenu
;
; primary properties
;
FieldPointer(prpVirtualTable) ; 16393 : pointer to the class virtual table
Field(priReferenceCount, typInt32) ; 16394 : class reference count
Field(priClassReferenceNumber, typInt32) ; 16447 : the entity number for the class (module, program, package, etc)
Field(exiChildEntryNumber, typInt32) ; 16484 : entry number of the object in the parent child array (1 based)
;
; private dvsam control blocks
;
;
; private file records
;
;
; private file objects
;
;
; private properties
;
FieldDynamicArray(proChild, objGeneric) ; 16448 : reference to a child object
Field(priChildCount, typInt32) ; 16451 : number of child objects attached to a parent object
;
; external properties: read/write
;
;
; external properties: read only
;
Field(exiGadgetNumber, typInt32) ; 16402 : assigned by pb using #pb_any
Field(exiActualLeft, typInt32) ; 16417 : actual left position of the gui object (pixels)
Field(exiActualTop, typInt32) ; 16418 : actual top position of the gui object (pixels)
Field(exiActualWidth, typInt32) ; 16419 : actual width of the gui object (pixels)
Field(exiActualHeight, typInt32) ; 16420 : actual height of the gui object (pixels)
;
; external properties: write only
;
Field(exiForegroundColour, typInt32) ; 14750 : foreground colour
Field(exiBackgroundColour, typInt32) ; 14751 : background colour
FieldCallBack(expCBDesign) ; 16080 : callback ptr: design an object
Field(exoParent, objGeneric) ; 16086 : reference to an object's parent
Field(exiMarginTop, typInt32) ; 16128 : top margin outside the gadget (pixels)
Field(exiMarginBottom, typInt32) ; 16129 : bottom margin outside the gadget (pixels)
Field(exiMarginLeft, typInt32) ; 16130 : left margin outside the gadget (pixels)
Field(exiMarginRight, typInt32) ; 16131 : right margin outside the gadget (pixels)
Field(exlResizeAllowed, typBoolean) ; 16405 : true = gui object can be resized
Field(exlShrinkAllowed, typBoolean) ; 16406 : true = gui object can shrink below the base size
Field(exiHorizontalAlignmentMode, typInt32) ; 16408 : fill, start, end, centre
Field(exlHorizontalAlignment, typBoolean) ; 16409 : true = horizontal gui object alignment is allowed
Field(exiVerticalAlignmentMode, typInt32) ; 16410 : fill, start, end, centre
Field(exlVerticalAlignment, typBoolean) ; 16411 : true = vertical gui object alignment is allowed
Field(exiBaseLeft, typInt32) ; 16413 : nominal left position of the gui object (pixels)
Field(exiBaseTop, typInt32) ; 16414 : nominal top position of the gui object (pixels)
Field(exiBaseWidth, typInt32) ; 16415 : nominal width of the gui object (pixels)
Field(exiBaseHeight, typInt32) ; 16416 : nominal height of the gui object (pixels)
Field(exsToolTip, typString) ; 16421 : tooltip text: blank = no tooltip
Field(exlShowSelection, typBoolean) ; 16467 : true = show item selection even if gadget does not have focus
Field(exlHideNodeLines, typBoolean) ; 16468 : true = hide connecting lines between nodes
Field(exlHideNodeButtons, typBoolean) ; 16469 : true = hide the node buttons (+)
Field(exlShowCheckboxes, typBoolean) ; 16470 : true = show a checkbox for each item
;
EndStructure
;
;===============================================
;
; Private Declares
;
DeclarePrivateSubroutine(Menu, Constructor) (ByVal(Me, strMenu))
DeclarePrivateSubroutine(Menu, Destructor) (ByVal(Me, strMenu))
DeclarePrivateSubroutine(Menu, ApplyExternalResizeRules) (ByVal(Me, strMenu))
;
;===============================================
;
; Primary Methods
;
;-----------------------------------------------
;
ExternalFunction(Menu, Create, typObject) ()
;
; Create create a class instance
;
Local(Me, strMenu)
Me = AllocateMemory(SizeOf(strMenu))
If IsObject(Me)
InitializeStructure(Me, strMenu)
Me\prpVirtualTable = LabelPtr(Menu, VirtualTable)
Me\priReferenceCount = 1
ClassCall(Menu, Constructor) (Me)
EndIf
ProcedureReturn Me
EndFunction
;
;-----------------------------------------------
;
ExternalFunction(Menu, Destroy, typObject) (ByVal(Me, strMenu))
;
; Destroy destroy a class instance
;
If IsObject(Me)
If Me\priReferenceCount > 1
Me\priReferenceCount = Me\priReferenceCount - 1
Else
ClassCall(Menu, Destructor) (Me)
ClearStructure(Me, strMenu)
FreeMemory(Me)
EndIf
EndIf
ProcedureReturn 0
EndFunction
;
;-----------------------------------------------
;
ExternalFunction(Menu, Clone, typObject) (ByVal(Me, strMenu))
;
; Clone clone a class instance
;
If IsObject(Me)
Me\priReferenceCount = Me\priReferenceCount + 1
EndIf
ProcedureReturn Me
EndFunction
;
;-----------------------------------------------
;
ExternalFunction(Menu, Class, typInt32) (ByVal(Me, strMenu))
;
; Class return the class reference number
;
ProcedureReturn Me\priClassReferenceNumber
EndFunction
;
;-----------------------------------------------
;
; exiChildEntryNumber 16484 : entry number of the object in the parent child array (1 based)
;
ExternalGet(Menu, exiChildEntryNumber, typInt32) (ByVal(Me, strMenu))
ProcedureReturn Me\exiChildEntryNumber
EndGet
;
ExternalSet(Menu, exiChildEntryNumber) (ByVal(Me, strMenu), ByVal(bviChildEntryNumber, typInt32))
Me\exiChildEntryNumber = bviChildEntryNumber
EndSet
;
;===============================================
;
; External Methods
;
;-----------------------------------------------
;
ExternalSubroutine(Menu, Events) (ByVal(Me, strMenu))
;
; Events process gadget events
;
;
Local(oGenericMenuItem, objMenuItem) ; 16104 : generic reference to a menuitem object
Local(iItemIndex, typInt32) ; 16478 : gadget item index (zero based)
iItemIndex = GetGadgetState(Me\exiGadgetNumber) ; get the currently selected item index (none = -1)
If iItemIndex >= 0 ; only process valid menu item indexes
oGenericMenuItem = GetGadgetItemData(Me\exiGadgetNumber, iItemIndex) ; reference the menu item object
ObjectCall(oGenericMenuItem, Events) () ; process the menu item event
EndIf
EndSubroutine
;
;-----------------------------------------------
;
ExternalSubroutine(Menu, Resize) (ByVal(Me, strMenu))
;
; Resize process a window resize event
;
;
;
; Note:
;
; Menu child objects (MenuItems) do not require resizing.
;
If IsFalse(Me\exlResizeAllowed)
ProcedureReturn
EndIf
ClassCall(Menu, ApplyExternalResizeRules) (Me) ; calculate new size
ResizeGadget(Me\exiGadgetNumber, Me\exiActualLeft, Me\exiActualTop, Me\exiActualWidth, Me\exiActualHeight)
EndSubroutine
;
;-----------------------------------------------
;
ExternalSubroutine(Menu, Attach) (ByVal(Me, strMenu))
;
; Attach attach this object to the application
;
;
Local(iGadgetFlags, typInt32) ; 16403 : composite option flags used when creating a pb gadget
ObjectCall(Me\exoParent, AttachChild) (CloneMe(Menu)) ; link this object to its parent
Me\exiActualLeft = Me\exiBaseLeft ; set the initial dimensions
Me\exiActualTop = Me\exiBaseTop
Me\exiActualWidth = Me\exiBaseWidth
Me\exiActualHeight = Me\exiBaseHeight
ClassCall(Menu, ApplyExternalResizeRules) (Me) ; calculate the initial size
If IsTrue(Me\exlShowSelection) ; 16467 : true = show item selection even if gadget does not have focus
iGadgetFlags = iGadgetFlags | #PB_Tree_AlwaysShowSelection
EndIf
If IsTrue(Me\exlHideNodeLines) ; 16468 : true = hide connecting lines between nodes
iGadgetFlags = iGadgetFlags | #PB_Tree_NoLines
EndIf
If IsTrue(Me\exlHideNodeButtons) ; 16469 : true = hide the node buttons (+)
iGadgetFlags = iGadgetFlags | #PB_Tree_NoButtons
EndIf
If IsTrue(Me\exlShowCheckboxes) ; 16470 : true = show a checkbox for each item
iGadgetFlags = iGadgetFlags | #PB_Tree_CheckBoxes
EndIf
Me\exiGadgetNumber = TreeGadget(#PB_Any, Me\exiActualLeft, Me\exiActualTop, Me\exiActualWidth, Me\exiActualHeight, iGadgetFlags)
SetGadgetData(Me\exiGadgetNumber, Me) ; link this object to its gadget
SetGadgetColor(Me\exiGadgetNumber, #PB_Gadget_FrontColor, Me\exiForegroundColour)
SetGadgetColor(Me\exiGadgetNumber, #PB_Gadget_BackColor, Me\exiBackgroundColour)
If NotNull(Me\exsToolTip)
GadgetToolTip(Me\exiGadgetNumber, Me\exsToolTip)
EndIf
CallBack(Me\expCBDesign) ; design the menu tree
SetGadgetItemState(Me\exiGadgetNumber, 0, #PB_Tree_Expanded) ; expand the first menu tree node
EndSubroutine
;
;-----------------------------------------------
;
ExternalSubroutine(Menu, AttachChild) (ByVal(Me, strMenu), ByRef(broChild, objGeneric))
;
; AttachChild attach a child object
;
; broChild 16448 : reference to a child object
;
If NotObject(Ref(broChild))
ProcedureReturn ; not a valid object
EndIf
Me\priChildCount = Me\priChildCount + 1 ; increment the child count
ReDim Me\proChild(Me\priChildCount) ; add an entry to the child array
Me\proChild(Me\priChildCount) = Ref(broChild) ; store the child object reference
Set(Ref(broChild), exiChildEntryNumber, Me\priChildCount) ; update the child entry number
EndSubroutine
;
;-----------------------------------------------
;
ExternalSubroutine(Menu, Detach) (ByVal(Me, strMenu))
;
; Detach detach this object from the application
;
;
EndSubroutine
;
;-----------------------------------------------
;
ExternalSubroutine(Menu, DetachChild) (ByVal(Me, strMenu), ByRef(broChild, objGeneric))
;
; DetachChild detach a child object
;
; broChild 16448 : reference to a child object
;
EndSubroutine
;
;===============================================
;
; Property Methods
;
;-----------------------------------------------
;
; external properties: read/write
;
;-----------------------------------------------
;
; external properties: read only
;
;--------
;
ExternalGet(Menu, exiGadgetNumber, typInt32) (ByVal(Me, strMenu))
ProcedureReturn Me\exiGadgetNumber
EndGet
;
;--------
;
ExternalGet(Menu, exiActualLeft, typInt32) (ByVal(Me, strMenu))
ProcedureReturn Me\exiActualLeft
EndGet
;
;--------
;
ExternalGet(Menu, exiActualTop, typInt32) (ByVal(Me, strMenu))
ProcedureReturn Me\exiActualTop
EndGet
;
;--------
;
ExternalGet(Menu, exiActualWidth, typInt32) (ByVal(Me, strMenu))
ProcedureReturn Me\exiActualWidth
EndGet
;
;--------
;
ExternalGet(Menu, exiActualHeight, typInt32) (ByVal(Me, strMenu))
ProcedureReturn Me\exiActualHeight
EndGet
;
;-----------------------------------------------
;
; external properties: write only
;
;--------
;
ExternalSet(Menu, exiForegroundColour) (ByVal(Me, strMenu), ByVal(bviForegroundColour, typInt32))
Me\exiForegroundColour = bviForegroundColour
EndSet
;
;--------
;
ExternalSet(Menu, exiBackgroundColour) (ByVal(Me, strMenu), ByVal(bviBackgroundColour, typInt32))
Me\exiBackgroundColour = bviBackgroundColour
EndSet
;
;--------
;
ExternalSet(Menu, expCBDesign) (ByVal(Me, strMenu), ByVal(bviIndex, typInt32), ByVal(bvpCBDesign, typPointer))
Me\expCBDesign(bviIndex) = bvpCBDesign
EndSet
;
;--------
;
ExternalSet(Menu, exoParent) (ByVal(Me, strMenu), ByVal(bvoParent, typObject))
Me\exoParent = bvoParent
EndSet
;
;--------
;
ExternalSet(Menu, exiMarginTop) (ByVal(Me, strMenu), ByVal(bviMarginTop, typInt32))
Me\exiMarginTop = bviMarginTop
EndSet
;
;--------
;
ExternalSet(Menu, exiMarginBottom) (ByVal(Me, strMenu), ByVal(bviMarginBottom, typInt32))
Me\exiMarginBottom = bviMarginBottom
EndSet
;
;--------
;
ExternalSet(Menu, exiMarginLeft) (ByVal(Me, strMenu), ByVal(bviMarginLeft, typInt32))
Me\exiMarginLeft = bviMarginLeft
EndSet
;
;--------
;
ExternalSet(Menu, exiMarginRight) (ByVal(Me, strMenu), ByVal(bviMarginRight, typInt32))
Me\exiMarginRight = bviMarginRight
EndSet
;
;--------
;
ExternalSet(Menu, exlResizeAllowed) (ByVal(Me, strMenu), ByVal(bvlResizeAllowed, typBoolean))
Me\exlResizeAllowed = bvlResizeAllowed
EndSet
;
;--------
;
ExternalSet(Menu, exlShrinkAllowed) (ByVal(Me, strMenu), ByVal(bvlShrinkAllowed, typBoolean))
Me\exlShrinkAllowed = bvlShrinkAllowed
EndSet
;
;--------
;
ExternalSet(Menu, exiHorizontalAlignmentMode) (ByVal(Me, strMenu), ByVal(bviHorizontalAlignmentMode, typInt32))
Me\exiHorizontalAlignmentMode = bviHorizontalAlignmentMode
EndSet
;
;--------
;
ExternalSet(Menu, exlHorizontalAlignment) (ByVal(Me, strMenu), ByVal(bvlHorizontalAlignment, typBoolean))
Me\exlHorizontalAlignment = bvlHorizontalAlignment
EndSet
;
;--------
;
ExternalSet(Menu, exiVerticalAlignmentMode) (ByVal(Me, strMenu), ByVal(bviVerticalAlignmentMode, typInt32))
Me\exiVerticalAlignmentMode = bviVerticalAlignmentMode
EndSet
;
;--------
;
ExternalSet(Menu, exlVerticalAlignment) (ByVal(Me, strMenu), ByVal(bvlVerticalAlignment, typBoolean))
Me\exlVerticalAlignment = bvlVerticalAlignment
EndSet
;
;--------
;
ExternalSet(Menu, exiBaseLeft) (ByVal(Me, strMenu), ByVal(bviBaseLeft, typInt32))
Me\exiBaseLeft = bviBaseLeft
EndSet
;
;--------
;
ExternalSet(Menu, exiBaseTop) (ByVal(Me, strMenu), ByVal(bviBaseTop, typInt32))
Me\exiBaseTop = bviBaseTop
EndSet
;
;--------
;
ExternalSet(Menu, exiBaseWidth) (ByVal(Me, strMenu), ByVal(bviBaseWidth, typInt32))
Me\exiBaseWidth = bviBaseWidth
EndSet
;
;--------
;
ExternalSet(Menu, exiBaseHeight) (ByVal(Me, strMenu), ByVal(bviBaseHeight, typInt32))
Me\exiBaseHeight = bviBaseHeight
EndSet
;
;--------
;
ExternalSet(Menu, exsToolTip) (ByVal(Me, strMenu), ByVal(bvsToolTip, typString))
Me\exsToolTip = bvsToolTip
EndSet
;
;--------
;
ExternalSet(Menu, exlShowSelection) (ByVal(Me, strMenu), ByVal(bvlShowSelection, typBoolean))
Me\exlShowSelection = bvlShowSelection
EndSet
;
;--------
;
ExternalSet(Menu, exlHideNodeLines) (ByVal(Me, strMenu), ByVal(bvlHideNodeLines, typBoolean))
Me\exlHideNodeLines = bvlHideNodeLines
EndSet
;
;--------
;
ExternalSet(Menu, exlHideNodeButtons) (ByVal(Me, strMenu), ByVal(bvlHideNodeButtons, typBoolean))
Me\exlHideNodeButtons = bvlHideNodeButtons
EndSet
;
;--------
;
ExternalSet(Menu, exlShowCheckboxes) (ByVal(Me, strMenu), ByVal(bvlShowCheckboxes, typBoolean))
Me\exlShowCheckboxes = bvlShowCheckboxes
EndSet
;
;===============================================
;
; Private Methods
;
;-----------------------------------------------
;
PrivateSubroutine(Menu, Constructor) (ByVal(Me, strMenu))
;
; Constructor class constructor
;
;
;
; auto generated code
;
Me\priClassReferenceNumber = #iCLASS_MOD_MENU ; Menu Class
;
; manual code
;
Me\exiForegroundColour = #iCOLOUR_DEFAULT
Me\exiBackgroundColour = #iCOLOUR_DEFAULT
EndSubroutine
;
;-----------------------------------------------
;
PrivateSubroutine(Menu, Destructor) (ByVal(Me, strMenu))
;
; Destructor class destructor
;
;
Local(iLoop, typInt32) ; 15051 : generic loop counter
;
; manual code
;
DestroyObject(Me\exoParent) ; 16086 : reference to an object's parent
For iLoop = 1 To Me\priChildCount
DestroyObject(Me\proChild(iLoop)) ; 16448 : reference to a child object
Next
;
; auto generated code
;
EndSubroutine
;
;-----------------------------------------------
;
PrivateSubroutine(Menu, ApplyExternalResizeRules) (ByVal(Me, strMenu))
;
; ApplyExternalResizeRules apply the external resize rules
;
;
Local(oGenericContainer, objContainer) ; 16077 : generic reference to a container object
Local(iParentWidth, typInt32) ; 16458 : parent container width (pixels)
Local(iParentHeight, typInt32) ; 16459 : parent container height (pixels)
Local(iParentPadding, typInt32) ; 16460 : parent container padding (pixels)
;
; Note:
;
; 1) If no horizontal alignment, then Me\exiActualLeft and Me\exiActualWidth remain unchanged
;
; 2) If no vertical alignment, then Me\exiActualTop and Me\exiActualHeight remain unchanged
;
oGenericContainer = Me\exoParent ; reference the parent container
iParentWidth = Get(oGenericContainer, exiActualWidth)
iParentHeight = Get(oGenericContainer, exiActualHeight)
iParentPadding = Get(oGenericContainer, exiPadding)
If IsTrue(Me\exlHorizontalAlignment)
Select Me\exiHorizontalAlignmentMode
Case #iGUI_ALIGN_FILL
Me\exiActualLeft = iParentPadding + Me\exiMarginLeft
Me\exiActualWidth = iParentWidth - iParentPadding - Me\exiMarginLeft - Me\exiMarginRight - iParentPadding
Case #iGUI_ALIGN_START
Me\exiActualLeft = iParentPadding + Me\exiMarginLeft
Case #iGUI_ALIGN_END
Me\exiActualLeft = iParentWidth - iParentPadding - Me\exiMarginRight - Me\exiActualWidth
Case #iGUI_ALIGN_CENTRE
Me\exiActualLeft = (iParentWidth - Me\exiActualWidth) / 2
EndSelect
EndIf
If IsTrue(Me\exlVerticalAlignment)
Select Me\exiVerticalAlignmentMode
Case #iGUI_ALIGN_FILL
Me\exiActualTop = iParentPadding + Me\exiMarginTop
Me\exiActualHeight = iParentHeight - iParentPadding - Me\exiMarginTop - Me\exiMarginBottom - iParentPadding
Case #iGUI_ALIGN_START
Me\exiActualTop = iParentPadding + Me\exiMarginTop
Case #iGUI_ALIGN_END
Me\exiActualTop = iParentHeight - iParentPadding - Me\exiMarginBottom - Me\exiActualHeight
Case #iGUI_ALIGN_CENTRE
Me\exiActualTop = (iParentHeight - Me\exiActualHeight) / 2
EndSelect
EndIf
EndSubroutine
;
;===============================================
;
; Virtual Table
;
DataSection
Label(Menu, VirtualTable)
;
; primary methods
;
InterfaceFunc(Menu, Destroy)
InterfaceFunc(Menu, Clone)
InterfaceFunc(Menu, Class)
InterfaceGetx(Menu, exiChildEntryNumber)
InterfaceSetx(Menu, exiChildEntryNumber)
;
; external methods
;
InterfaceSubr(Menu, Events)
InterfaceSubr(Menu, Resize)
InterfaceSubr(Menu, Attach)
InterfaceSubr(Menu, AttachChild)
InterfaceSubr(Menu, Detach)
InterfaceSubr(Menu, DetachChild)
;
; external properties: read/write
;
;
; external properties: read only
;
InterfaceGetx(Menu, exiGadgetNumber)
InterfaceGetx(Menu, exiActualLeft)
InterfaceGetx(Menu, exiActualTop)
InterfaceGetx(Menu, exiActualWidth)
InterfaceGetx(Menu, exiActualHeight)
;
; external properties: write only
;
InterfaceSetx(Menu, exiForegroundColour)
InterfaceSetx(Menu, exiBackgroundColour)
InterfaceSetx(Menu, expCBDesign)
InterfaceSetx(Menu, exoParent)
InterfaceSetx(Menu, exiMarginTop)
InterfaceSetx(Menu, exiMarginBottom)
InterfaceSetx(Menu, exiMarginLeft)
InterfaceSetx(Menu, exiMarginRight)
InterfaceSetx(Menu, exlResizeAllowed)
InterfaceSetx(Menu, exlShrinkAllowed)
InterfaceSetx(Menu, exiHorizontalAlignmentMode)
InterfaceSetx(Menu, exlHorizontalAlignment)
InterfaceSetx(Menu, exiVerticalAlignmentMode)
InterfaceSetx(Menu, exlVerticalAlignment)
InterfaceSetx(Menu, exiBaseLeft)
InterfaceSetx(Menu, exiBaseTop)
InterfaceSetx(Menu, exiBaseWidth)
InterfaceSetx(Menu, exiBaseHeight)
InterfaceSetx(Menu, exsToolTip)
InterfaceSetx(Menu, exlShowSelection)
InterfaceSetx(Menu, exlHideNodeLines)
InterfaceSetx(Menu, exlHideNodeButtons)
InterfaceSetx(Menu, exlShowCheckboxes)
;
EndDataSection
;
;===============================================
; end of : clsMenu.pbi
;===============================================
Last edited by BorisTheOld on Fri Jan 04, 2013 7:10 am, edited 2 times in total.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
~ Spike Milligan
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: Rename ProcedureReturn to Return
uwekel, Gosub/Return is standard Basic. As Boris said, macros are what you want (they are made for this very reason: to personalise the language to what you want), and/or you should enable AutoComplete so that you don't have to type those extra 9 characters of "ProcedureReturn". 

Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: Rename ProcedureReturn to Return
About the suggestions of using macros:
Using macros and residents unfortunately is always a problem when you want to share code with others in the forum.
If you don't obviously it's a non issue.
But If you do you have to supply both and it's easy to forget some piece.
Moreover it's not "standard" PB code anymore and can be confusing to read.
What I do is using a program which monitors the PB IDE window and expand my shorcuts to whatever I want.
For example if I type ;pr this is expanded to "ProcedureReturn", if I type ;ifr (include file relative) this is expanded to "IncludeFile #PB_Compiler_FilePath +" and so on.
I use a script I made with AutoHotKey, but any similar program will do.
Using macros and residents unfortunately is always a problem when you want to share code with others in the forum.
If you don't obviously it's a non issue.
But If you do you have to supply both and it's easy to forget some piece.
Moreover it's not "standard" PB code anymore and can be confusing to read.
What I do is using a program which monitors the PB IDE window and expand my shorcuts to whatever I want.
For example if I type ;pr this is expanded to "ProcedureReturn", if I type ;ifr (include file relative) this is expanded to "IncludeFile #PB_Compiler_FilePath +" and so on.
I use a script I made with AutoHotKey, but any similar program will do.
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: Rename ProcedureReturn to Return
For macros: no, it's not a problem. The poster just has to include the macro definition. And if they don't, then it's no different to any other post where the readers reply with: "Please post a working snippet."luis wrote:Using macros and residents unfortunately is always a problem when you want to share code with others in the forum.
If the macro is included, then no, it's not confusing to read. It's all there, black and white.luis wrote:Moreover it's not "standard" PB code anymore and can be confusing to read
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: Rename ProcedureReturn to Return
Why not for macros ? And if not for macros then yes for what ? Residents ?MachineCode wrote: For macros: no, it's not a problem.
A macro can be in residents.
I'm quite sure I just wrote the same thing in my post. That was the problem. If it isn't a problem for you, that's fine.MachineCode wrote: The poster just has to include the macro definition.
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: Rename ProcedureReturn to Return
I meant yes for residents, obviously. One can't include a residents file in a forum post.luis wrote:if not for macros then yes for what ? Residents ?
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: Rename ProcedureReturn to Return
He has to extract the definitions (again macros and constants) from the source of the resident and post it along with his code he wants to share.MachineCode wrote: Yes for residents: how does one include a residents file in a forum post?
Since the proposed method of altering the name of some PB keywords on your system reasonably involves storing the relative macros in residents, to have them always working and readily available, than I call it problematic when you want to share your code.
1) The macro is probably in a resident, see above. So instead of copy and paste your snippet you have to open the resident file and select your "redefining-keywords" macros and add them.MachineCode wrote: What's so problematic about including a short macro definition in a post?
2) You have to remember to put all the macros involved, or come back and fix it, once, twice, etc. Depending on the sloppiness level of the person doing this.
3) At a first glance your code is not like the other code in the forum: instead of ProcedureReturn you have a Return, instead of an include you have an IncludeRelative, etc. etc.
Personally I would dislike it. A thing is a macro doing something useful for the problem, another thing is a macro altering the set of keywords of the language because you like it more. That's why it's ok for yourself, not for the forum (for small snippets of code as in the tips and tricks section).
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
Re: Rename ProcedureReturn to Return
Thanks to Luis for your comments and the nice idea to use Autohotkey to speed things up.
I also like the funny postings about Basic standards (!)
___
10 Macro Plus(minus)
20 -minus
30 EndMacro
40 Macro One(fortwo)
50 int(sign(infinity()))
60 EndMacro
70 Print Plus(One(MC))
I also like the funny postings about Basic standards (!)

___
10 Macro Plus(minus)
20 -minus
30 EndMacro
40 Macro One(fortwo)
50 int(sign(infinity()))
60 EndMacro
70 Print Plus(One(MC))
Re: Rename ProcedureReturn to Return
I think it's not just a matter of typing, but also matters readability and coding standards.
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2