Jump to content

Need suggestion for scrollable information structure


qwert
 Share

Recommended Posts

I'm trying to fashion a scrollable child window that consists of a "table" of fixed-format elements ... where each element contains 4 fields of information.  It is almost identical to what Windows uses to present system tray settings.  Two of the fields are stacked, so (I think) a ListView with a graphic won't work.

There will be a maximum of 40 of the "structures", so my first thought was to hard code the 40, vertically ... 160 controls, in all.  It's simple, but lengthy.  I'll also mention that I have to be able to detect mouse clicks and cursor position from the window.

So, before I implement anything, I wanted to ask: is there a "macro" approach to implementing this? 

Also, what search terms might locate suitable designs?

Thanks in advance for any suggestions.

 

Marked Example.png

Link to comment
Share on other sites

  • Moderators

@qwert have you looked at _GUIScrollbars_EnableScrollBar in the help file? The example script should give you some ideas.

As for creating your controls, there are a couple of examples throughout the forum of using arrays for creating and placing comboboxes, checkboxes, etc. that may give you some ideas.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks for your response.

Actually, I have the scrolling of the child window down pretty well, thanks to an excellent example from a forum post (citation needed here, but I've attached the GUI, for reference).

The problem I need to solve is how to define a group of controls in a macro fashion:

Elements.PNG

Regarding your reference to "using arrays for creating and placing ...", can you suggest any search keywords?  Array and Create return too many results.

Scroll Bar Test.PNG

Link to comment
Share on other sites

  • Moderators

You can use GUICtrlCreateGroup to group your controls, and then act upon the group.

As for creating arrays of controls, I did the following google search: site:autoitscript.com array of radio buttons

This is just one thread I see: 

 

Look at Melba's post #18 for an idea.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks, again.  But I couldn't get a handle on the idea of grouping controls.  Since there were no scroll bars, it seems to be an example of populating controls from text in files by way of an array.  Obviously, I've missed your point.

 

 

Link to comment
Share on other sites

  • Moderators

Perhaps I am misunderstanding your requirements. Lets begin with the grouping of controls; we'll look at the scrollbars once we're on the same page. Based on your OP, and the picture of the Notification Area Icons screen you posted, my assumption is that you're looking to group your controls together on the GUI, something like this:

#include <GUIConstantsEx.au3>

    $hGUI = GUICreate("Testing Groups of Controls", 720, 350)

    $sGroup1 = GUICtrlCreateGroup("Group1", 10, 10, 680, 100)
        GUICtrlCreateIcon("shell32.dll", 10, 25, 40, 40, 40)
        GUICtrlCreateLabel("Please choose a drive", 150, 50, 250, 40)
            GUICtrlSetFont(-1, 16, 400, Default, "Arial")
        GUICtrlCreateCombo("", 480, 45, 150, 40)
            GUICtrlSetFont(-1, 16, 400, Default, "Arial")
            GUICtrlSetData(-1, "C:|D:|E:")
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;Close $sGroup1

    $sGroup2 = GUICtrlCreateGroup("Group1", 10, 120, 680, 100)
        GUICtrlCreateIcon("shell32.dll", 10, 25, 135, 40, 40)
        GUICtrlCreateLabel("Please choose a drive", 150, 145, 250, 40)
            GUICtrlSetFont(-1, 16, 400, Default, "Arial")
        GUICtrlCreateCombo("", 480, 140, 150, 40)
            GUICtrlSetFont(-1, 16, 400, Default, "Arial")
            GUICtrlSetData(-1, "C:|D:|E:")
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;Close $sGroup2

    $sGroup3 = GUICtrlCreateGroup("Group1", 10, 230, 680, 100)
        GUICtrlCreateIcon("shell32.dll", 10, 25, 245, 40, 40)
        GUICtrlCreateLabel("Please choose a drive", 150, 255, 250, 40)
            GUICtrlSetFont(-1, 16, 400, Default, "Arial")
        GUICtrlCreateCombo("", 480, 250, 150, 40)
            GUICtrlSetFont(-1, 16, 400, Default, "Arial")
            GUICtrlSetData(-1, "C:|D:|E:")
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;Close $sGroup3

        GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch
    WEnd

...and that, in addition, if you can figure out how to get around having to declare each control individually that would be a bonus. If this is not correct, can you please elaborate on where I am mistaken?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

13 minutes ago, JLogan3o13 said:

how to get around having to declare each control individually

Indeed, that's what I mean by "macro" create.  In doing so, each element has to its own control ID, of course, for referencing by the GUI's processing (i.e., this is not just for display purposes).

I agree that scrolling the built structure in a child window is the easy part.

I've added a date field to your example to indicate that it can't just be a ListView-style table.

 

Group.PNG

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...