Jump to content

Scrolling in a GUI


Recommended Posts

heres the code im using.

#include <GuiConstants.au3>
GuiCreate("MyGUI", 700, 500,-1, -1 ,  BitOR($WS_VSCROLL, $WS_CLIPSIBLINGS, $WS_OVERLAPPEDWINDOW))

$Combo_1 = GuiCtrlCreateCombo("Skill", 80, 40, 100, 21)

;fletching calc
$Input_8 = GuiCtrlCreateInput("99", 600, 90, 20, 20)
$Input_7 = GuiCtrlCreateInput("1", 700, 40, 20, 20)
$Input_9 = GuiCtrlCreateInput("KickassJoe", 310, 140, 100, 20)
$Input_19 = GuiCtrlCreateInput("Experience", 310, 170, 100, 20)

$Group_18 = GuiCtrlCreateGroup("Type of Action", 220, 30, 200, 80)

$Radio_1 = GuiCtrlCreateRadio("Radio1", 230, 50, 10, 10)
$Radio_2 = GuiCtrlCreateRadio("Radio2", 230, 80, 10, 10)

$Label_5 = GuiCtrlCreateLabel("Current Level?", 470, 40, 110, 20)
$Label_6 = GuiCtrlCreateLabel("Desired Level?", 470, 90, 80, 20)
$Label_10 = GuiCtrlCreateLabel("Retrieve Current XP", 430, 140, 100, 20)
$Label_11 = GuiCtrlCreateLabel("Level", 70, 230, 50, 20)
$Label_12 = GuiCtrlCreateLabel("Experience Gained", 380, 230, 110, 20)
$Label_13 = GuiCtrlCreateLabel("Number", 510, 230, 40, 20)
$Label_14 = GuiCtrlCreateLabel("Members?", 620, 230, 60, 20)
$Label_22 = GuiCtrlCreateLabel("Full Bows? (fletch & string)", 250, 50, 140, 20)
$Label_23 = GuiCtrlCreateLabel("Half Bows? (only cut or only string)", 250, 80, 170, 20)
$Label_24 = GuiCtrlCreateLabel("Name of Action", 230, 230, 140, 20)
$Lvl = GuiCtrlCreateLabel("1", 70, 700, 20, 20)
For $i = 1 to 20
$Lvl = GuiCtrlCreateLabel("1", 70, ($i * 30) + 240, 20, 20)
Next

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

I am not familiar with $WS_VSCROLL, but it is not working how I think it should be. I put a bunch of label 1's at coordinates that were more then the GUI is, and when I try to scroll down, I can't. How would I go about making it so that I can scroll down in the GUI can see the label 1's that I have put there? (there are ~ 13 label 1's that are not showing...)

What goes around comes around... Payback's a bitch.

Link to comment
Share on other sites

C:\PROGRA~1\AutoIt3\beta\Include\GUIScrollBars.au3(49,48) : WARNING: $m_width: possibly used before declaration.
    $iMaxWidth = (($cxChar * $cxCaps) - ($m_width -
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\PROGRA~1\AutoIt3\beta\Include\GUIScrollBars.au3(49,57) : WARNING: $c_left: possibly used before declaration.
    $iMaxWidth = (($cxChar * $cxCaps) - ($m_width - $c_left)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\PROGRA~1\AutoIt3\beta\Include\GUIScrollBars.au3(49,71) : WARNING: $c_width: possibly used before declaration.
    $iMaxWidth = (($cxChar * $cxCaps) - ($m_width - $c_left) + ($c_width /
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\PROGRA~1\AutoIt3\beta\Include\GUIScrollBars.au3(62,57) : WARNING: $m_height: possibly used before declaration.
    DllStructSetData($tagSCROLLINFO, $si_nMax, (($m_height -
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\PROGRA~1\AutoIt3\beta\Include\GUIScrollBars.au3(62,65) : WARNING: $c_top: possibly used before declaration.
    DllStructSetData($tagSCROLLINFO, $si_nMax, (($m_height - $c_top)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\PROGRA~1\AutoIt3\beta\Include\GUIScrollBars.au3(62,78) : WARNING: $c_height: possibly used before declaration.
    DllStructSetData($tagSCROLLINFO, $si_nMax, (($m_height - $c_top) + $c_height)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\PROGRA~1\AutoIt3\beta\Include\GUIScrollBars.au3(49,48) : ERROR: $m_width: undeclared global variable.
    $iMaxWidth = (($cxChar * $cxCaps) - ($m_width -
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Joe\Desktop\Fletch GUI.au3 - 1 error(s), 6 warning(s)

Thats what I get when using this code:

#include <GuiConstants.au3>
#include <GUIScrollBars.au3>
$GUI = GuiCreate("MyGUI", 700, 500,-1, -1 , BitOR($WS_VSCROLL, $WS_CLIPSIBLINGS, $WS_OVERLAPPEDWINDOW))

$Combo_1 = GuiCtrlCreateCombo("Skill", 80, 40, 100, 21)

;fletching calc
$Input_8 = GuiCtrlCreateInput("99", 600, 90, 20, 20)
$Input_7 = GuiCtrlCreateInput("1", 700, 40, 20, 20)
$Input_9 = GuiCtrlCreateInput("KickassJoe", 310, 140, 100, 20)
$Input_19 = GuiCtrlCreateInput("Experience", 310, 170, 100, 20)

$Group_18 = GuiCtrlCreateGroup("Type of Action", 220, 30, 200, 80)

$Radio_1 = GuiCtrlCreateRadio("Radio1", 230, 50, 10, 10)
$Radio_2 = GuiCtrlCreateRadio("Radio2", 230, 80, 10, 10)

$Label_5 = GuiCtrlCreateLabel("Current Level?", 470, 40, 110, 20)
$Label_6 = GuiCtrlCreateLabel("Desired Level?", 470, 90, 80, 20)
$Label_10 = GuiCtrlCreateLabel("Retrieve Current XP", 430, 140, 100, 20)
$Label_11 = GuiCtrlCreateLabel("Level", 70, 230, 50, 20)
$Label_12 = GuiCtrlCreateLabel("Experience Gained", 380, 230, 110, 20)
$Label_13 = GuiCtrlCreateLabel("Number", 510, 230, 40, 20)
$Label_14 = GuiCtrlCreateLabel("Members?", 620, 230, 60, 20)
$Label_22 = GuiCtrlCreateLabel("Full Bows? (fletch & string)", 250, 50, 140, 20)
$Label_23 = GuiCtrlCreateLabel("Half Bows? (only cut or only string)", 250, 80, 170, 20)
$Label_24 = GuiCtrlCreateLabel("Name of Action", 230, 230, 140, 20)
$Lvl = GuiCtrlCreateLabel("1", 70, 700, 20, 20)
For $i = 1 to 20
$Lvl = GuiCtrlCreateLabel("1", 70, ($i * 30) + 240, 20, 20)
Next

;scrollbar
GUIRegisterMsg($WM_VSCROLL, "MY_WM_VSCROLL")
    GUISetState()
    Local $RangeMinMax = _GetScrollRange($GUI, $SB_VERT)
    ConsoleWrite("Vert Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1] & @LF)
    
    _SetScrollRange($GUI, $SB_VERT, 0, 400)

_EnableScrollBar ($GUI, $SB_VERT, False)
    Sleep(3000)
    _EnableScrollBar ($GUI, $SB_VERT)

_ShowScrollBar ($GUI, $SB_VERT, False)
    Sleep(3000)
    _ShowScrollBar ($GUI, $SB_VERT)
    
    _SetScrollPos ($GUI, $SB_VERT, 10)
    Sleep(3000)
    _SetScrollPos ($GUI, $SB_VERT, 0)
    
    _SetScrollRange($GUI, $SB_VERT, 0, 400)
    
$RangeMinMax = _GetScrollRange($GUI, $SB_VERT)
    ConsoleWrite("Vert Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1] & @LF)







GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

By the way Gary, Thanks A LOT for helping me out! :whistle:

SUPER DUPER EDIT: nvm I got it. ;)

Edited by Kickassjoe

What goes around comes around... Payback's a bitch.

Link to comment
Share on other sites

yea, I ended up just putting my ctrls into your code, and then deleting the child windows, and your ctrls, I put the globals in, but I was still missing something else, and it wouldn't work, and then I switched the ctrls of your code and it worked fine.... oh well, whatever works. :whistle:

P.S. This is gonna be a big program, and I needed the help. thanks much!

What goes around comes around... Payback's a bitch.

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...