Sign in to follow this  
Followers 0
Percius

Child Window -- Sizes and Scrollbars

10 posts in this topic

I am createing a GUI with a child window. The child window needs to be appear to be exacty 500x300 pix so that it sits exactly where I want it in the parrent window. I can set that All fine and dandy and have the window show up exactly as I want it, but what I cannot seem to do is make the scroll bar work. The actual size of the window's contents is 500x500. Any Ideas.

If I set the window size to that then the child window just disappears off the side of the main window.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

How are you getting the child window to sit in a certain spot in the parent window?

If you are using auto center on the parent window then setting a pixel location on the child window when you change resolutions its gonna throw your windows off.

Just thought I'd add that.

This could be solved by using the resolution macro to get the screen width then triggering 1 of the seperate child window locations.

Sorry if Im telling you stuff you already know, or that doesnt apply.

I will check your scroll bar when u upload your code.

Edited by megahyperion

Share this post


Link to post
Share on other sites

Sorry Here is What I am Doing. This Shows up exactly as I want it, but the Problem is that I have some 50 check boxes in the child window so I need it to be able to scroll while maintaining the set window size.

$MainWindow = GuiCreate ( "Window Name", 600, 450 )

OPT("GUICOORDMODE", "1")

$ChildGUI = GuiCreate("Child", 500, 250, 50, 100, 0x40200000, ''", $MainWindow)

Of course I have actual buttons in the window last one being at 10, 490 for child window coordinates.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Sorry that the info was not helpful.

Here is the exact file. It works excluding the scroll bar with the most current beta.

$file = "C:\test.jpg"

$WS_CHILD = 0x40000000
$WS_VSCROLL = 0x00200000
$ChildStyle = BitOr($WS_VSCROLL,$WS_CHILD)

$MainWindow = GUICreate ( "Select Checkboxes", 600, 450)
Opt("GUICoordMode", 1)
Opt("TrayIconHide", 1) 
GUISetBkColor ( 0xFFFFFF )

$next = GUICtrlCreateButton("Next", 520, 415, 75)

GuiCtrlCreatePic($file, 100, 0, 400, 100); Set the Background Picture

; Create Box Text
$Welecome = "Select the Checkboxes You Want"

$font="Comic Sans MS"
GUISetFont (14, 400, "", $font)
GUICtrlCreateLabel ( $Welecome , 60, 75 , 500 , 25 )



$ChildGUI = GUICreate ( "Child", 500, 250, 50 , 100 , $ChildStyle , "", $MainWindow )

GUISwitch ( $ChildGUI )

    GUISetBkColor ( 0xFFFFFF )

# First Row
    GUICtrlCreateCheckbox ( "Program 1", 10, 10 )
    GUICtrlCreateCheckbox ( "Program 2", 10, 30 )
    GUICtrlCreateCheckbox ( "Program 3", 10, 50 )
    GUICtrlCreateCheckbox ( "Program 4", 10, 70 )
    GUICtrlCreateCheckbox ( "Program 5", 10, 90 )
    GUICtrlCreateCheckbox ( "Program 6", 10, 110 )
    GUICtrlCreateCheckbox ( "Program 7", 10, 130 )
    GUICtrlCreateCheckbox ( "Program 8", 10, 150 )
    GUICtrlCreateCheckbox ( "Program 9", 10, 170 )
    GUICtrlCreateCheckbox ( "Program 10", 10, 190 )
    GUICtrlCreateCheckbox ( "Program 11", 10, 210 )
    GUICtrlCreateCheckbox ( "Program 12", 10, 230 )
    GUICtrlCreateCheckbox ( "Program 13", 10, 250 )
    GUICtrlCreateCheckbox ( "Program 14", 10, 270 )
    GUICtrlCreateCheckbox ( "Program 15", 10, 290 )
    GUICtrlCreateCheckbox ( "Program 16", 10, 310 )
    GUICtrlCreateCheckbox ( "Program 17", 10, 330 )
    GUICtrlCreateCheckbox ( "Program 18", 10, 350 )
    GUICtrlCreateCheckbox ( "Program 19", 10, 370 )
    GUICtrlCreateCheckbox ( "Program 20", 10, 390 )
    GUICtrlCreateCheckbox ( "Program 21", 10, 410 )
    GUICtrlCreateCheckbox ( "Program 22", 10, 430 )
    GUICtrlCreateCheckbox ( "Program 23", 10, 450 )
    GUICtrlCreateCheckbox ( "Program 24", 10, 470 )
    GUICtrlCreateCheckbox ( "Program 25", 10, 490 )
    
# Second Row
    GUICtrlCreateCheckbox ( "Program 26", 230, 10 )
    GUICtrlCreateCheckbox ( "Program 27", 230, 30 )
    GUICtrlCreateCheckbox ( "Program 28", 230, 50 )
    GUICtrlCreateCheckbox ( "Program 29", 230, 70 )
    GUICtrlCreateCheckbox ( "Program 30", 230, 90 )
    GUICtrlCreateCheckbox ( "Program 31", 230, 110 )
    GUICtrlCreateCheckbox ( "Program 32", 230, 130 )
    GUICtrlCreateCheckbox ( "Program 33", 230, 150 )
    GUICtrlCreateCheckbox ( "Program 34", 230, 170 )
    GUICtrlCreateCheckbox ( "Program 35", 230, 190 )
    GUICtrlCreateCheckbox ( "Program 36", 230, 210 )
    GUICtrlCreateCheckbox ( "Program 37", 230, 230 )
    GUICtrlCreateCheckbox ( "Program 38", 230, 250 )
    GUICtrlCreateCheckbox ( "Program 39", 230, 270 )
    GUICtrlCreateCheckbox ( "Program 40", 230, 290 )
    GUICtrlCreateCheckbox ( "Program 41", 230, 310 )
    GUICtrlCreateCheckbox ( "Program 42", 230, 330 )
    GUICtrlCreateCheckbox ( "Program 43", 230, 350 )
    GUICtrlCreateCheckbox ( "Program 44", 230, 370 )
    GUICtrlCreateCheckbox ( "Program 45", 230, 390 )
    GUICtrlCreateCheckbox ( "Program 46", 230, 410 )
    GUICtrlCreateCheckbox ( "Program 47", 230, 430 )
    GUICtrlCreateCheckbox ( "Program 48", 230, 450 )
    GUICtrlCreateCheckbox ( "Program 49", 230, 470 )
    GUICtrlCreateCheckbox ( "Program 50", 230, 490 )


GUISwitch ( $MainWindow )
GuiSetState()
GUISwitch ( $ChildGUI )
GuiSetState()
GUISwitch ( $MainWindow )

    Func NxtMsg()
        $msg = $next
    EndFunc

While 1
  $msg = GUIGetMsg()
  Select
    Case $msg = $next
        ExitLoop
    EndSelect
Wend
Edited by Percius

Share this post


Link to post
Share on other sites

Rule #1: Do not add styles together, they must be BitOR'd. They aren't binary, they are hex, and as such, adding them may not produce the same result as BitOR'ing. The expected results (By Windows) is for the numbers to be BitOR'd.

This probably doesn't have anything to do with your problem, but is both a bug in your code and a bad habit to get into.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I fixed the code line to be Bit or'd, but as for me I actually just use the Hex instead of variables. I put them in that way because of the request. to use the GuiConstants.

Edited by Percius

Share this post


Link to post
Share on other sites

Using the numbers is a bad idea. The reason being, in about 2 days, you'll forget what they are and now you don't have a clue what styles you are passing. Plus, when posting example code, nobody knows what styles you are using, either, and you'll get bitched at, just like this.

Share this post


Link to post
Share on other sites

Well I dont want to get bitched at, I just wish I could figure out how to make the scroll bar work.

Share this post


Link to post
Share on other sites

Unfortunately since the Checkboxes are Barely related it would be hard to catagorize them into appropriately sized checkboxes, but Unless the next version supports scroll bars and comes out soon I am going to have to resort to check boxes, scroll bars, or just redoing the WHOLE thing in VB.

Share this post


Link to post
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
Sign in to follow this  
Followers 0