Example: XP ExlorerBar and Grouping Objects

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Worm
    Indigo Rose Customer
    • Jul 2002
    • 3971

    Example: XP ExlorerBar and Grouping Objects

    This project groups objects together to perform actions on the group. The key to this is to have the objects name within a group start with a "group name".

    For example: if you have a label named: lblTitle and another named lblAuthor, to group them, simple rename the objects to grp1_lblTitle and grp1_lblAuthor. The included function shows how to enumerate the page objects, then perform the needed action on all objects within the group.
    Attached Files
    Last edited by Desmond; 06-27-2005, 12:39 PM.
  • Dermot
    Indigo Rose Customer
    • Apr 2004
    • 1791

    #2
    That's fantastic Worm, thanks for sharing. I see what you mean about input and listbix objects flickering but I think for the most part as a menu system you would use labels buttons or images.

    Dermot
    Dermot

    I am so out of here :yes

    Comment

    • Worm
      Indigo Rose Customer
      • Jul 2002
      • 3971

      #3
      Thanks!
      You're right. When using Labels, Buttons, Images and I think Paragraphs, the Application.Redraw trick makes it work fairly smooth.

      With the other objects I had to turn the redraw on before performing any actions on them or the actions didn't take. Keeping these objects to a minimum should allow it to be smooth.

      Originally posted by Dermot
      That's fantastic Worm, thanks for sharing. I see what you mean about input and listbix objects flickering but I think for the most part as a menu system you would use labels buttons or images.

      Dermot

      Comment

      • Ted Sullivan
        Indigo Rose Staff Member
        • Oct 2003
        • 963

        #4
        Very nice job! Just when you think you've seen it all, Worm impresses once again.
        New Release: Setup Factory 9.6 adds Windows 11 compatibility and support for hardware token OV/EV Code Signing certificates.

        Comment

        • Worm
          Indigo Rose Customer
          • Jul 2002
          • 3971

          #5
          Here is another function that could be used in the project to enable/disable the group

          Code:
          --[[
          	Function to set a group of objects Enabled/Disabled
          ]]--
          function SetGroupEnabled(sGroupName, blnEnabled)
          	-- get all objects on the page
          	tblObjects = Page.EnumerateObjects()
          	--set the app to not redraw until we're ready
          	Application.SetRedraw(false)
          	--loop through the object on the page
          	for index, object in tblObjects do
          		--if the object is part of the group that was passed to the function
          		if String.Left(object, String.Length(sGroupName)) == sGroupName then
          			--get the objects type
          			ObjectType = Page.GetObjectType(object)
          			--once we have the type, we can use a series of
          			--IF statements to run the correct actions
          			if ObjectType == OBJECT_BUTTON then
           				Button.SetEnabled(object, blnHide)
          			elseif ObjectType == OBJECT_LABEL then
          			 	Label.SetEnabled(object, blnHide)
          			elseif ObjectType == OBJECT_PARAGRAPH then
          			 	Paragraph.SetEnabled(object, blnHide)
          			elseif ObjectType == OBJECT_IMAGE then
          				Image.SetEnabled(object, blnHide)
          			elseif ObjectType == OBJECT_FLASH then
          				Application.SetEnabled(true)			
          				Flash.SetVisible(object, blnHide)			 
          				Application.SetEnabled(false)
          			elseif ObjectType == OBJECT_VIDEO then
          				Application.SetEnabled(true)			
          				Video.SetVisible(object, blnHide)
          				Application.SetEnabled(false)
          			elseif ObjectType == OBJECT_WEB then 
          				Application.SetEnabled(true)
          				Web.SetVisible(object, blnHide)
          				Application.SetEnabled(false)
          			elseif ObjectType == OBJECT_INPUT then
          				Application.SetEnabled(true)
          				Input.SetVisible(object, blnHide)	
          				Application.SetEnabled(false)
          			elseif ObjectType == OBJECT_HOTSPOT then 
          				HotSpot.SetVisible(object, blnHide)
          			elseif ObjectType == OBJECT_LISTBOX then
          				Application.SetEnabled(true)			
          			 	ListBox.SetVisible(object, blnHide)
          			 	Application.SetEnabled(false)
          			elseif ObjectType == OBJECT_PLUGIN then
          				Application.SetEnabled(true)			
          				Plugin.SetVisible(object, blnHide)
          				Application.SetEnabled(false)
          			end
          		end
          	end
          	--space out the buttons
          	SpaceXPBars()
          	--let the app redraw
          	Application.SetRedraw(true)
          end

          Comment

          • Intrigued
            Indigo Rose Customer
            • Dec 2003
            • 6138

            #6
            That's pretty neat, useful! Nice looking demo as well. :yes
            Intrigued

            Comment

            • rhosk
              Indigo Rose Customer
              • Aug 2003
              • 1698

              #7
              Looks as if you spent a lot of time on that. Awesome stuff.
              Regards,

              -Ron

              Music | Video | Pictures

              Comment

              • yosik
                Indigo Rose Customer
                • Jun 2002
                • 1858

                #8
                VERY neat project.
                It WILL come handy. Thanks for sharing, Worm.

                Yossi

                Comment

                • JimS
                  Indigo Rose Customer
                  • May 2003
                  • 1057

                  #9
                  Wow! What a useful set of functions for GUI design. Thank you for sharing. As usual, your code always makes the task seem so trivial. I couldn’t do in 600 lines of code, what you’ve done in less than 150. I sure wished I had some of your talent when it comes to really distilling a problem down to it’s core, like you are able to do.

                  We can even change the physical size, add or subtract groups, and your functions still work. This means that we are free to customize the GUI, without changing a single line of code, and still have everything work properly. This is good stuff, I’m sure that your wonderful gift will find a home in more than one of my future projects.

                  Who’da thunk it could be so easy?

                  It has my mind racing with thoughts of what kind of cool GUI’s could be created by combining these functions, with the power of your SetMask DLL.

                  Worm, thank you for the more than gracious, and quite blatant promotion of my AMS addon and website. You are more than a gentleman, sir, and abundantly kind.



                  .

                  Comment

                  • Worm
                    Indigo Rose Customer
                    • Jul 2002
                    • 3971

                    #10
                    Originally posted by JimS
                    This means that we are free to customize the GUI, without changing a single line of code
                    I wish that were true, but the FOR loop in SpaceXPBars needs to be adjusted to the number of buttons Bars you have minus one. So if you decide to have 5 ExplorerBars, then the loop needs to be

                    for n=1, 4 do -- 5 bars less 1 bar = 4

                    Other than that, the rest of the functions should work without too much modificiation if any.

                    As for the promo of your tools, what can I say, it's good stuff!! I can definitely thank those of you who are gifted in design for helping someone who's "creatively challenged" like myself. I have a much nicer looking version that uses your kit, but didn't post it to avoid giving away your work

                    Comment

                    • JimS
                      Indigo Rose Customer
                      • May 2003
                      • 1057

                      #11
                      Thanks for the clarification Worm. I resized the groups in your example, and it worked fine, although I posted before I actually tried adding more groups.

                      I’m still trying to get my head around the math you use for repositioning the groups. You make it look so easy. Thanks for taking the extra time to comment your code so thoroughly, it makes it so much easier for numbskulls like me to follow.

                      Maybe if I can tear apart, enough of your code examples, I’ll eventually be able to teach my brain to think more as you do. I hope so, but I’m not placing any bets.

                      Perhaps if I’m lucky, I can persuade the I-man into giving me a swig of whatever juice he’s been drinking lately, so I too will be able to learn new stuff with the speed, and apparent ease, of a child. Go Intrigued!



                      .

                      Comment

                      • Intrigued
                        Indigo Rose Customer
                        • Dec 2003
                        • 6138

                        #12
                        Perhaps if I’m lucky, I can persuade the I-man into giving me a swig of whatever juice he’s been drinking lately, so I too will be able to learn new stuff with the speed, and apparent ease, of a child. Go Intrigued!
                        Well, I have to thank Worm for violently shaking me at the shoulders and getting me motivated in a different direction (but still indirectly related to AMS 5 coding!)

                        The juice... well it's currently under Tradmark status. *hands Jim a Non Disclosure Agreement laden clipboard*

                        Intrigued

                        Comment

                        • JimS
                          Indigo Rose Customer
                          • May 2003
                          • 1057

                          #13
                          Worm, don’t sell yourself short on the graphical design side. Making the whole Explorer Bar a single button, instead of just an arrow button as I did, was simply ingenious my friend. It more correctly emulates the way each Explorer bar works, with fewer pieces, and less code.

                          I’m embarrassed to say, but I’ve always clicked on the arrows of an Explorer bar, and didn’t realize until I tried your example, that the whole Explorer bar is clickable. Your Explorer Bar button is unquestionably superior, and that’s not even the coolest part of your example.

                          Your code is so cool, that it is easy to overlook how smart your graphics are. Thanks again for sharing. :yes

                          Intrigued, whatever the cause, keep it up. It’s uplifting to see someone tearing through new material with the ferocity that you have been showing lately. Well, it is uplifting, until I compare it with what I’ve accomplished lately, then it becomes a bit depressing. Oh well, at least it’s good to know someone who is motivated. :yes



                          .

                          Comment

                          • Worm
                            Indigo Rose Customer
                            • Jul 2002
                            • 3971

                            #14
                            Bah! I didn't realize it either Jimbo, when I read your post, I had to go and try it to see

                            How 'bout that... I did good :lol

                            Comment

                            • Intrigued
                              Indigo Rose Customer
                              • Dec 2003
                              • 6138

                              #15
                              Another "That'a boy" award!

                              Woot'saaa!
                              Intrigued

                              Comment

                              Working...
                              X