Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Programming question

Programming question

Scheduled Pinned Locked Moved The Lounge
helpquestioncsharpc++
37 Posts 17 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Jeremy Falcon

    Yeah, I still think macros are great as long as they aren't abused.

    Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)

    R Offline
    R Offline
    Ryan Binns
    wrote on last edited by
    #27

    Jeremy Falcon wrote:

    Yeah, I still think macros are great as long as they aren't abused.

    You don't consider your example macro abuse? :omg:

    Ryan

    "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

    J 1 Reply Last reply
    0
    • R Ryan Binns

      Jeremy Falcon wrote:

      Yeah, I still think macros are great as long as they aren't abused.

      You don't consider your example macro abuse? :omg:

      Ryan

      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #28

      Ryan Binns wrote:

      You don't consider your example macro abuse?

      No I don't. It's not so much what you do with them that's abusive, but more so how much you rely on them and the intent that is. If there's no clean/quick/portable way to achieve the bracket replacement that he's trying to do so he can program more effeciently, but yet macros offer a simple solution then it's not abusive. OTOH if he's trying to make Pascal syntax out of C/C++ just because it's neato, then that's very abusive (and I've seen people attempt this).

      Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)

      S 1 Reply Last reply
      0
      • L Lost User

        My idea is to press Shift+Space and then "{ \newline }" would be insterted at the cursor position. How could I do that, via Snippet, Macro, Addin?

        S Offline
        S Offline
        S Douglas
        wrote on last edited by
        #29

        Greeeg wrote:

        Macro

        Thats pretty easy,

        Sub CurlyBrackets()
            Dim sCurly As String
            sCurly = "{ " & vbNewLine & vbNewLine & " }"
            ActiveDocument.Selection.Text = sCurly
        End Sub
        

        Just map that to a key combo and away you go.


        I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:

        L 1 Reply Last reply
        0
        • J Jeremy Falcon

          Ryan Binns wrote:

          You don't consider your example macro abuse?

          No I don't. It's not so much what you do with them that's abusive, but more so how much you rely on them and the intent that is. If there's no clean/quick/portable way to achieve the bracket replacement that he's trying to do so he can program more effeciently, but yet macros offer a simple solution then it's not abusive. OTOH if he's trying to make Pascal syntax out of C/C++ just because it's neato, then that's very abusive (and I've seen people attempt this).

          Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)

          S Offline
          S Offline
          S Douglas
          wrote on last edited by
          #30

          Jeremy Falcon wrote:

          If there's no clean/quick/portable way to achieve the bracket replacement that he's trying to do so he can program more effeciently, but yet macros offer a simple solution then it's not abusive.

          There is a way, use a VS macro, they are easy to create (heck VS has a macro recorder) and assign it to a key combo. Done, no worries about someone else looking at your code wondering WTF is BO & BC for.


          I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:

          J 1 Reply Last reply
          0
          • S S Douglas

            Jeremy Falcon wrote:

            If there's no clean/quick/portable way to achieve the bracket replacement that he's trying to do so he can program more effeciently, but yet macros offer a simple solution then it's not abusive.

            There is a way, use a VS macro, they are easy to create (heck VS has a macro recorder) and assign it to a key combo. Done, no worries about someone else looking at your code wondering WTF is BO & BC for.


            I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:

            J Offline
            J Offline
            Jeremy Falcon
            wrote on last edited by
            #31

            S Douglas wrote:

            There is a way, use a VS macro

            If VS is your only environment then yeah I totally agree. Go with that instead.

            Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)

            S 1 Reply Last reply
            0
            • L Lost User

              Yeah, this is really a programming question, sort of :~ What I really hate is typing curly braces in languages like C#/C++ etc. I use a german keyboard layout and typing { and } involes using a weird combination, Alt+Gr+7 for { and Alt+Gr+0 for } Not only does this disturb the typing flow, but the combination is also really unhandy and error prone, especially when switching keybords often (laptop, desktop, work etc). What are your solutions to this problem? :) regards

              A Offline
              A Offline
              Anders Molin
              wrote on last edited by
              #32

              I use a Danish keyboard and kinda have the same problem. I solved it by making a simple macro in VS, so when I press ctrl-æ VS change the line, insert a { change the line again and insert a } and move the caret to be right after the {. Works great :)

              - Anders My new photo website[^]

              L 1 Reply Last reply
              0
              • J Jeremy Falcon

                S Douglas wrote:

                There is a way, use a VS macro

                If VS is your only environment then yeah I totally agree. Go with that instead.

                Jeremy Falcon The mind is like a parachute. It works best when it is open. - Colin Angus Mackay (2006-08-18)

                S Offline
                S Offline
                S Douglas
                wrote on last edited by
                #33

                Jeremy Falcon wrote:

                If VS is your only environment

                Now that you mention it, he didn't specify what enviroment he was working in, much less which version. Kinda important. :shrugs: all yea can do is offer a suggestion.


                I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:

                1 Reply Last reply
                0
                • S S Douglas

                  Greeeg wrote:

                  Macro

                  Thats pretty easy,

                  Sub CurlyBrackets()
                      Dim sCurly As String
                      sCurly = "{ " & vbNewLine & vbNewLine & " }"
                      ActiveDocument.Selection.Text = sCurly
                  End Sub
                  

                  Just map that to a key combo and away you go.


                  I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #34

                  Works like a charm, thanks a lot! :rose: regards

                  S 1 Reply Last reply
                  0
                  • A Anders Molin

                    I use a Danish keyboard and kinda have the same problem. I solved it by making a simple macro in VS, so when I press ctrl-æ VS change the line, insert a { change the line again and insert a } and move the caret to be right after the {. Works great :)

                    - Anders My new photo website[^]

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #35

                    Yeah, I from now on use this solution, and it works perfectly :) regards

                    1 Reply Last reply
                    0
                    • L Lost User

                      Works like a charm, thanks a lot! :rose: regards

                      S Offline
                      S Offline
                      S Douglas
                      wrote on last edited by
                      #36

                      Greeeg wrote:

                      Works like a charm

                      :cool: Your welcome


                      I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:

                      1 Reply Last reply
                      0
                      • L Lost User

                        Yeah, this is really a programming question, sort of :~ What I really hate is typing curly braces in languages like C#/C++ etc. I use a german keyboard layout and typing { and } involes using a weird combination, Alt+Gr+7 for { and Alt+Gr+0 for } Not only does this disturb the typing flow, but the combination is also really unhandy and error prone, especially when switching keybords often (laptop, desktop, work etc). What are your solutions to this problem? :) regards

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #37

                        Just macro it #define IF if{ #define ENDIF } #define ELSE }else{ and so on and so on. Eventually, it'lll look like VB! ha ha!

                        Truth is the subjection of reality to an individuals perception

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups