Announcement

Collapse
No announcement yet.

"With / End With" construct missing from PB?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rodney Hicks
    replied
    It seems a little unjust to me to be complaining about what isn't in PB 9 less than a month after PB released a new version just because it might have been in some other language.

    Had they sent in NFSs requesting those features?
    Not that that means if they had the feature should appear.

    It seems to me that PB gave us plenty of tools for us to get our heads around, needful tools. The luxurious tools can come later, if at all.

    By focusing on what PB has, you'll find a way to get your job done.
    By focusing on what PB hasn't, you won't get very far.

    Leave a comment:


  • jcfuller
    replied
    How about a macro?
    MACRO wdah=Word.Documents.Add.Headers(%wdHeaderFooterPrimary).Range
    wdah.Font.Name = sFontName
    wdah.Font.Size
    wdah.Paragraphs.Alignment = %wdAlignParagraphCenter
    wdah.Text = uDay.Name

    Not tried.

    James

    Leave a comment:


  • Ian Webling
    replied
    Rodney,

    What Wes and, to a lesser extent, Vladimir are asking is not for PB to become VB (only two and a bit of Vladimir's requests are actually found in VB) but, with the WITH/END WITH statements, to become a little more user-friendly. For example, once using COM to access MS Word it could not be considered unusual to have lines such as:

    Word.Documents.Add.Headers(%wdHeaderFooterPrimary).Range.Font.Name = sFontName
    Word.Documents.Add.Headers(%wdHeaderFooterPrimary).Range.Font.Size = rFontSize
    Word.Documents.Add.Headers(%wdHeaderFooterPrimary).Range.Paragraphs.Alignment = %wdAlignParagraphCenter
    Word.Documents.Add.Headers(%wdHeaderFooterPrimary).Range.Text = uDay.Name

    Now, while there are workarounds to code such as this, they involve creating temporary variables. In VB one could write:

    WITH Word.Documents.Add.Headers(%wdHeaderFooterPrimary).Range
    .Font.Name = sFontName
    .Font.Size = rFontSize
    .Paragraphs.Alignment = %wdAlignParagraphCenter
    .Text = uDay.Name
    END WITH

    Leave a comment:


  • Rodney Hicks
    replied
    Guys,
    PowerBASIC is not VB.
    Something that is not in PB that never was in PB is not really missing.
    Programming in PowerBASIC is not programming in VB.
    Programming in PowerBASIC may require different thought processes than those acquired by users of VB or any other language.
    Change, while at times bewildering, can be good for you.

    Leave a comment:


  • WesWesthaver
    started a topic "With / End With" construct missing from PB?

    "With / End With" construct missing from PB?

    I have been reading the on-line documentation for the new PB and it appears that the "With / End With" construct found in VB and VBScript is missing in PB.

    I always found the "With" statement to be a really nice way to tickle multiple properties and methods of an object without having to reference the object over and over again. I also feel that it makes your code cleaner and easier to read:

    With MyObject
    .PropertyA = this
    .PropertyB = that
    .PropertyC = theotherthing
    .DoMethod
    End With

    Does anyone know why this construct is missing? Will the "With / End With" construct be added to PB?
Working...
X
😀
🥰
🤢
😎
😡
👍
👎