Jump to content

Problem with Inputbox/Label's not hiding.


Damein
 Share

Recommended Posts

To fully test this on other machines, I will post the entire source. It's rough, spaghetti code at the moment. I will clean up after I remove bugs etc.

I have 22 input boxes and labels on one tab, and 23 input boxes and labels on another. 21 input boxes/labels change each time. The other input boxes/labels do not hide, they stay on both tabs.

Here is the source.

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Global $NewItemLabel, $NewCost, $TotalWeeklyCost, $VarianceFromLastWeek, $SaveBudgetButton, $IniFile, $IniFileInfo, $LastWeeksBudgetTab, $CurrentWeeksBudgetTab
Global $Gui1, $BudgetTabs, $PreviousLabelForLocation[40], $PreviousInputBoxForLocation[40], $PreviousLabelForSpentAmount[40], $PreviousInputBoxForSpentAmount[40]
Global $YAlignment, $GDILine, $GDIPen, $PreviousLineForConnectorBox[40], $PreviousAlreadyCreated, $PreviousLineForConnectorBox2
Global $PreviousLineForConnectorBox3, $PreviousLabelForTotalCost, $PreviousInputBoxForTotalCost, $CurrentLabelForLocation[40], $CurrentInputBoxForLocation[40]
Global $CurrentLabelForSpentAmount[40], $CurrentInputBoxForSpentAmount[40], $CurrentLineForConnectorBox[40], $CurrentAlreadyCreated, $CurrentLineForConnectorBox2
Global $CurrentLineForConnectorBox3, $CurrentLineForConnectorBox4, $CurrentLabelForTotalCost,  $CurrentInputBoxForTotalCost, $PreviousBudgetInfoLocation[40], $PreviousBudgetInfoSpentAmount[40]
Global $PreviousBudgetTotal, $CurrentBudgetInfoLocation[40], $CurrentBudgetInfoSpentAmount[40], $CurrentBudgetTotal, $VarianceBudgetTotal, $CurrentLabelForVariance, $CurrentInputBoxForVariance
 
Opt("GUIOnEventMode", 1)
 
 
$IniFile = "Budget.ini"
$IniFileInfo = IniReadSection($IniFile, "PreviousBudget")
If @error Then
IniWrite($IniFile, "PreviousBudget", "", "")
Else
For $i = 1 To $IniFileInfo[0][0]
$PreviousBudgetInfoLocation[$i] = $IniFileInfo[$i][0]
$PreviousBudgetInfoSpentAmount[$i] = $IniFileInfo[$i][1]
$PreviousBudgetTotal += $IniFileInfo[$i][1]
Next
EndIf
$IniFileInfo2 = IniReadSection($IniFile, "CurrentBudget")
If @error Then
IniWrite($IniFile, "CurrentBudget", "", "")
Else
For $i = 1 To $IniFileInfo2[0][0]
$CurrentBudgetInfoLocation[$i] = $IniFileInfo2[$i][0]
$CurrentBudgetInfoSpentAmount[$i] = $IniFileInfo2[$i][1]
$CurrentBudgetTotal += $IniFileInfo2[$i][1]
$VarianceBudgetTotal = $PreviousBudgetTotal - $CurrentBudgetTotal
Next
EndIf
_CreateGui()
Func _CreateGui()
    $Gui1 = GUICreate("Budgeting System", 800, 700, Default, Default)
    $BudgetTabs = GUICtrlCreateTab(10, 5, 780, 680)
    $LastWeeksBudgetTab = GUICtrlCreateTabItem("Previous Week")
$CurrentWeeksBudgetTab = GUICtrlCreateTabItem("Current Week")
    GUICtrlSetOnEvent($BudgetTabs, "_DetectTabEnabled")
    GUICtrlCreateTabItem("")
    GUISetState()
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $Gui1)
EndFunc   ;==>_CreateGui
Func _DetectTabEnabled()
    Switch GUICtrlRead($BudgetTabs)
        Case 0
            _PreviousWeekBudget()
        Case 1
            _CurrentWeekBudget()
    EndSwitch
EndFunc
Func _PreviousWeekBudget()
   GuiCtrlSetState($CurrentInputBoxForTotalCost, $GUI_HIDE)
   GuiCtrlSetState($CurrentLabelForTotalCost, $GUI_HIDE)
  For $i = 1 To 21 +1
  $YAlignment = 0
  GuiCtrlSetState($CurrentLabelForLocation[$i], $GUI_HIDE)
  GuiCtrlSetState($CurrentLabelForSpentAmount[$i], $GUI_HIDE)
  GuiCtrlSetState($CurrentInputBoxForLocation[$i], $GUI_HIDE)
  GuiCtrlSetState($CurrentInputBoxForSpentAmount[$i], $GUI_HIDE)
  GuiCtrlSetState($CurrentLineForConnectorBox[$i], $GUI_HIDE)
  GuiCtrlSetState($CurrentLineForConnectorBox2, $GUI_HIDE)
  GuiCtrlSetState($CurrentLineForConnectorBox3, $GUI_HIDE)
  Next
If $PreviousAlreadyCreated = 1 Then
  For $i = 1 To 21 +1
  GuiCtrlSetState($PreviousLabelForLocation[$i], $GUI_SHOW)
  GuiCtrlSetState($PreviousLabelForSpentAmount[$i], $GUI_SHOW)
  GuiCtrlSetState($PreviousLabelForTotalCost, $GUI_SHOW)
  GuiCtrlSetState($PreviousInputBoxForLocation[$i], $GUI_SHOW)
  GuiCtrlSetState($PreviousInputBoxForSpentAmount[$i], $GUI_SHOW)
  GuiCtrlSetState($PreviousInputBoxForTotalCost, $GUI_SHOW)
  GuiCtrlSetState($PreviousLineForConnectorBox[$i], $GUI_SHOW)
  GuiCtrlSetState($PreviousLineForConnectorBox2, $GUI_SHOW)
  GuiCtrlSetState($PreviousLineForConnectorBox3, $GUI_SHOW)
Next
  Else
_GDIPlus_Startup ()
$GDILine = _GDIPlus_GraphicsCreateFromHWND ($Gui1)
$GDIPen = _GDIPlus_PenCreate ()
For $i = 1 To 21 Step +1
  $YAlignment += 31
  $PreviousLabelForLocation[$i] = GuiCtrlCreateLabel("Purchased At:", 20,$YAlignment, 120,30)
  $PreviousInputBoxForLocation[$i] = GuiCtrlCreateInput("", 100,$YAlignment,120,20)
  GuiCtrlSetData(-1, $PreviousBudgetInfoLocation[$i])
  $PreviousLabelForSpentAmount[$i] = GuiCtrlCreateLabel("Cost:", 250,$YAlignment, 120,30)
  $PreviousInputBoxForSpentAmount[$i] = GuiCtrlCreateInput("", 290,$YAlignment,120,20)
  GuiCtrlSetData(-1, $PreviousBudgetInfoSpentAmount[$i])
  $PreviousLabelForTotalCost = GuiCtrlCreateLabel("Total:", 510,325, 120,30)
  $PreviousInputBoxForTotalCost = GuiCtrlCreateInput("", 540,322,120,20)
  GuiCtrlSetData(-1, "$ " & $PreviousBudgetTotal)
  $PreviousLineForConnectorBox[$i] = _GDIPlus_GraphicsDrawLine ($GDILine, 410, $YAlignment+8, 450, $YAlignment+8, $GDIPen)
  $PreviousLineForConnectorBox2 = _GDIPlus_GraphicsDrawLine ($GDILine, 450, 39, 451, 659.5, $GDIPen)
  $PreviousLineForConnectorBox3 = _GDIPlus_GraphicsDrawLine ($GDILine, 450, 330, 500, 330, $GDIPen)
Next
_GDIPlus_PenDispose ($GDIPen)
    _GDIPlus_GraphicsDispose ($GDILine)
    _GDIPlus_Shutdown ()
$PreviousAlreadyCreated = 1
EndIf
EndFunc
Func _CurrentWeekBudget()
GuiCtrlSetState($PreviousInputBoxForTotalCost, $GUI_HIDE)
  GuiCtrlSetState($PreviousLabelForTotalCost, $GUI_HIDE)
For $i = 1 To 21 +1
  $YAlignment = 0
  GuiCtrlSetState($PreviousLabelForLocation[$i], $GUI_HIDE)
  GuiCtrlSetState($PreviousLabelForSpentAmount[$i], $GUI_HIDE)
  GuiCtrlSetState($PreviousInputBoxForLocation[$i], $GUI_HIDE)
  GuiCtrlSetState($PreviousInputBoxForSpentAmount[$i], $GUI_HIDE)
  GuiCtrlSetState($PreviousLineForConnectorBox[$i], $GUI_HIDE)
  GuiCtrlSetState($PreviousLineForConnectorBox2, $GUI_HIDE)
  GuiCtrlSetState($PreviousLineForConnectorBox3, $GUI_HIDE)
  Next 
If $CurrentAlreadyCreated = 1 Then
For $i = 1 To 21 +1
  GuiCtrlSetState($CurrentLabelForLocation[$i], $GUI_SHOW)
  GuiCtrlSetState($CurrentLabelForSpentAmount[$i], $GUI_SHOW)
  GuiCtrlSetState($CurrentLabelForTotalCost, $GUI_SHOW)
  GuiCtrlSetState($CurrentInputBoxForLocation[$i], $GUI_SHOW)
  GuiCtrlSetState($CurrentInputBoxForSpentAmount[$i], $GUI_SHOW)
  GuiCtrlSetState($CurrentInputBoxForTotalCost, $GUI_SHOW)
  GuiCtrlSetState($CurrentLineForConnectorBox[$i], $GUI_SHOW)
  GuiCtrlSetState($CurrentLineForConnectorBox2, $GUI_SHOW)
  GuiCtrlSetState($CurrentLineForConnectorBox3, $GUI_SHOW)
Next
  Else
_GDIPlus_Startup ()
$GDILine = _GDIPlus_GraphicsCreateFromHWND ($Gui1)
$GDIPen = _GDIPlus_PenCreate ()
For $i = 1 To 21 Step +1
  $YAlignment += 31
  $CurrentLabelForLocation[$i] = GuiCtrlCreateLabel("Purchased At:", 20,$YAlignment, 120,30)
  $CurrentInputBoxForLocation[$i] = GuiCtrlCreateInput("", 100,$YAlignment,120,20)
  GuiCtrlSetData(-1, $CurrentBudgetInfoLocation[$i])
  $CurrentLabelForSpentAmount[$i] = GuiCtrlCreateLabel("Cost:", 250,$YAlignment, 120,30)
  $CurrentInputBoxForSpentAmount[$i] = GuiCtrlCreateInput("", 290,$YAlignment,120,20)
  GuiCtrlSetData(-1, $CurrentBudgetInfoSpentAmount[$i])
  $CurrentLabelForTotalCost = GuiCtrlCreateLabel("Total:", 470,325, 90,30)
  $CurrentInputBoxForTotalCost = GuiCtrlCreateInput("", 500,322,60,20)
  GuiCtrlSetData(-1, "$ " & $CurrentBudgetTotal)
  $CurrentLabelForVariance = GuiCtrlCreateLabel("Variance:", 605,325, 120,30)
  $CurrentInputBoxForVariance = GuiCtrlCreateInput("", 655,322,60,20)
  GuiCtrlSetData(-1, "$ " & $VarianceBudgetTotal)
  $CurrentLineForConnectorBox[$i] = _GDIPlus_GraphicsDrawLine ($GDILine, 410, $YAlignment+8, 450, $YAlignment+8, $GDIPen)
  $CurrentLineForConnectorBox2 = _GDIPlus_GraphicsDrawLine ($GDILine, 450, 39, 451, 659.5, $GDIPen)
  $CurrentLineForConnectorBox3 = _GDIPlus_GraphicsDrawLine ($GDILine, 450, 330, 470, 330, $GDIPen)
Next
_GDIPlus_PenDispose ($GDIPen)
    _GDIPlus_GraphicsDispose ($GDILine)
    _GDIPlus_Shutdown ()
$CurrentAlreadyCreated = 1
EndIf
EndFunc
While 1
    Sleep(10)
WEnd
Func _Exit()
    Exit
EndFunc

Why does my alignment vanish when I post the code via the code widget? Anyways, as you can see theres a lot of randomness in it. But the main thing to look it is:

GuiCtrlSetState($CurrentInputBoxForTotalCost, $GUI_HIDE)
GuiCtrlSetState($CurrentLabelForTotalCost, $GUI_HIDE)

For both Current and Previous.

Now, for the information to be seen you need an ini file.

This is what I have in it for testing.

[PreviousBudget]
Test1=10
Test2=20
Test3=30
Test4=40
Test5=50
Test6=60
Test7=70
Test8=80
Test9=90
Test10=100
Test11=110
Test12=120
Test13=130
Test14=140
Test15=150
Test16=160
Test17=170
Test18=180
Test19=190
Test20=200
Test21=210
[CurrentBudget]
Test1=100
Test2=200
Test3=3
Test4=4
Test5=5
Test6=6
Test7=7
Test8=8
Test9=9
Test10=10
Test11=11
Test12=12
Test13=13
Test14=14
Test15=15
Test16=16
[Budget]
=

Put that in an ini file labeled "Budget" and save it in the same location as the code.

Click on the "Current" tab and you should see all the info. Click on the Previous tab and you'll see all of the inputboxes/labels changed, except the totals.

As a sidenote, I added the 1 on the labels for Current in order to make sure it was only the totals not changing.

Thanks in advance.

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

As a sidenote, I added this in after the Hide's:

Local $Msg1 = GuiCtrlGetState($CurrentInputBoxForTotalCost)
Local $Msg2 = GuiCtrlGetState($CurrentLabelForTotalCost)
MsgBox(0, "test", $Msg1 & @CRLF & $Msg2)

And I got the msg "96" for both of them. I thought it would either be 1 or 0... not 100% sure what that means.

Also, adding

GuiCtrlDelete($CurrentInputBoxForTotalCost)
GuiCtrlDelete($CurrentLabelForTotalCost)

Result in no effect :/

This is crazy.

BUT!

If I do GUI_DISABLE it does get grayed out, at least that shows I CAN effect it in some way.. just not hide or delete it :/

Edited by Damein

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

There is no result because you are creating always new controls! You got hundreds of them!

Just create them once!

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

What do you mean? I only created them once. The var $PreviousAlreadyCreated and $CurrentAlreadyCreated ensure that.

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

OK, you are right, i was just because of the messy script. Not often saw something like this.

Try to tidy up your source and look into the documentation how to handle with tab controls.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

As a sidenote, I added this in after the Hide's:

Local $Msg1 = GuiCtrlGetState($CurrentInputBoxForTotalCost)
Local $Msg2 = GuiCtrlGetState($CurrentLabelForTotalCost)
MsgBox(0, "test", $Msg1 & @CRLF & $Msg2)

And I got the msg "96" for both of them. I thought it would either be 1 or 0... not 100% sure what that means.

Looking into the include, i see that 0 is $GUI_AVISTOP and 1 is $GUI_AVISTART or $GUI_CHECKED... Why would you expect them? Doesn't really make sense. 96 would be 32 ($GUI_HIDE) + 64 ($GUI_ENABLE), that sounds more interesting to me.

And:

For $i = 1 To 21 Step +1
  $PreviousLabelForTotalCost = GuiCtrlCreateLabel("Total:", 510,325, 120,30)
  $PreviousInputBoxForTotalCost = GuiCtrlCreateInput("", 540,322,120,20)
Next

creating 21 controls on each other and not saving the control id's of the 20 first is kinda weird. funkey is right, you should create them once only!

Edit:

And _GDIPlus_GraphicsDrawLine returns True or False, not a control id! I suggest you start using the helpfile instead of doing random weird stuff :mellow:

Edited by AdmiralAlkex
Link to comment
Share on other sites

Maybe this

#include <GDIPlus.au3>
#include <Constants.au3>

;~ Global Const $IMAGE_BITMAP = 0
Global Const $STM_SETIMAGE = 0x172

$hGui = GUICreate("Tabs")

$iTab = GUICtrlCreateTab(10, 10, 200, 380)

$iTabItem1 = GUICtrlCreateTabItem("Tab 1")
For $i = 1 To 8
    GUICtrlCreateLabel("Comprado a:", 20, $i * 40 + 10, 60, 20)
    GUICtrlCreateInput("a monoscout999 por su pollo!", 90, $i * 40 + 8, 100, 24)
Next

$iTabItem2 = GUICtrlCreateTabItem("Tab 2")
For $i = 1 To 8
    GUICtrlCreateLabel("Comprado a:", 20, $i * 40 + 10, 60, 20)
    GUICtrlCreateInput("a monoscout999 por su pollo!", 90, $i * 40 + 8, 100, 24)
Next

$iTabItem3 = GUICtrlCreateTabItem("Tab 4")
For $i = 1 To 8
    GUICtrlCreateLabel("Comprado a:", 20, $i * 40 + 10, 60, 20)
    GUICtrlCreateInput("a monoscout999 por su pollo!", 90, $i * 40 + 8, 100, 24)
Next

GUICtrlCreateTabItem("")

$iPic = GUICtrlCreatePic("", 210, 30, 60, 360)
_CreateLineImageToPic($hGui, $iPic)

GuiCtrlCreateLabel("Total", 270,186,30,20)
GuiCtrlCreateInput("",300,184,60,24)
GUISetState()

Do
Until GUIGetMsg() = -3

Func _CreateLineImageToPic($hGui, $iPic)
    Local $aPos = ControlGetPos($hGui, "", $iPic)
    _GDIPlus_Startup()
    Local $hImage = _GDIPlus_BitmapCreateFromScan0($aPos[2], $aPos[3])
    Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
    Local $hPen = _GDIPlus_PenCreate(0xFF0000FF, 2)
    Local $hEndCap = _GDIPlus_ArrowCapCreate(3, 6)
    _GDIPlus_GraphicsDrawLine($hGraphics, $aPos[2] / 2, 58 - $aPos[1], $aPos[2] / 2, 8 * 40 + 18 - $aPos[1], $hPen)
    For $i = 1 To 8
        _GDIPlus_GraphicsDrawLine($hGraphics, 0, $i * 40 + 18 - $aPos[1], $aPos[2] / 2, $i * 40 + 18 - $aPos[1], $hPen)
    Next
    _GDIPlus_PenSetCustomEndCap($hPen, $hEndCap)
    _GDIPlus_GraphicsDrawLine($hGraphics, $aPos[2] / 2, (8 * 40 + 36 - $aPos[1]) / 2, $aPos[2], (8 * 40 + 36 - $aPos[1]) / 2, $hPen)
    Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap))
    _WinAPI_DeleteObject($hBitmap)
    _GDIPlus_ArrowCapDispose($hEndCap)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hImage)
    _GDIPlus_Shutdown()
EndFunc   ;==>_CreateLineImageToPic

Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[6]
EndFunc   ;==>_GDIPlus_BitmapCreateFromScan0
Link to comment
Share on other sites

  • 2 weeks later...

Alright, this is good. Sorry, I somehow forgot about this topic ^^;

I can't seem to figure out how to correctly move the Y axis on the lines to center on the boxes. If you could help with that it would be great.

This is what I have so far:

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <StaticConstants.au3>
#include <Constants.au3>
 
Global Const $STM_SETIMAGE = 0x172
 
Global $YAlignment = 40
Global $hGUI
Global $hGraphic
Global $hPen
 
 
Global $NewItemLabel, $NewCost, $TotalWeeklyCost, $VarianceFromLastWeek, $SaveBudgetButton, $IniFile, $IniFileInfo, $LastWeeksBudgetTab, $CurrentWeeksBudgetTab
Global $PreviousBudgetInfoLocation[40], $PreviousBudgetInfoSpentAmount[40]
Global $PreviousBudgetTotal, $CurrentBudgetInfoLocation[40], $CurrentBudgetInfoSpentAmount[40], $CurrentBudgetTotal, $VarianceBudgetTotal
 
Opt("GUIOnEventMode", 1)
;~ $IniFile = "Budget.ini"
 
 
;~ $IniFileInfo = IniReadSection($IniFile, "PreviousBudget")
;~ If @error Then
;~  IniWrite($IniFile, "PreviousBudget", "", "")
;~ Else
;~  For $i = 1 To $IniFileInfo[0][0]
;~  $PreviousBudgetInfoLocation[$i] = $IniFileInfo[$i][0]
;~  $PreviousBudgetInfoSpentAmount[$i] = $IniFileInfo[$i][1]
;~  $PreviousBudgetTotal += $IniFileInfo[$i][1]
;~ Next
;~ EndIf
 
;~ $IniFileInfo2 = IniReadSection($IniFile, "CurrentBudget")
;~ If @error Then
;~  IniWrite($IniFile, "CurrentBudget", "", "")
;~ Else
;~  For $i = 1 To $IniFileInfo2[0][0]
;~  $CurrentBudgetInfoLocation[$i] = $IniFileInfo2[$i][0]
;~  $CurrentBudgetInfoSpentAmount[$i] = $IniFileInfo2[$i][1]
;~  $CurrentBudgetTotal += $IniFileInfo2[$i][1]
;~  $VarianceBudgetTotal = $PreviousBudgetTotal - $CurrentBudgetTotal
;~ Next
;~ EndIf
 
Global $hGUI = GUICreate("Budgetting System", 800, 700)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hGui)
GUISetState()
;~  _GDIPlus_Startup ()
;~  Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
;~  Global $hPen = _GDIPlus_PenCreate ()
    $BudgetTabs = GUICtrlCreateTab(10, 5, 780, 680)
    $LastWeeksBudgetTab = GUICtrlCreateTabItem("Previous Week")
For $i = 1 To 21
GUICtrlCreateLabel("Purchased At:", 20, $i * 30 + 10, 80, 30)
GUICtrlCreateInput("1", 90, $i * 30 + 8, 100, 24)
;~  GuiCtrlSetData(-1, $PreviousBudgetInfoLocation[$i])
GuiCtrlCreateLabel("Cost:", 210, $i * 30 + 10, 80,30)
GuiCtrlCreateInput("1", 240, $i * 30 + 8,100,24)
;~  GuiCtrlSetData(-1, $PreviousBudgetInfoSpentAmount[$i])
_GDIPlus_GraphicsDrawLine ($hGraphic, 342, $YAlignment+8, 380, $YAlignment+8, $hPen)
$YAlignment += 30
Next
GuiCtrlCreateLabel("Total:", 402,312, 120,30)
GuiCtrlCreateInput("1", 435, 308,100,24)
;~  GuiCtrlSetData(-1, $PreviousBudgetTotal)
;~  _GDIPlus_GraphicsDrawLine ($hGraphic, 380, 49, 380, $YAlignment-22, $hPen)
;~  _GDIPlus_GraphicsDrawLine ($hGraphic, 380, 318, 400, 318, $hPen)
 
$CurrentWeeksBudgetTab = GUICtrlCreateTabItem("Current Week")
$YAlignment = 40
For $i = 1 To 21
;~  _GDIPlus_Startup ()
;~  Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
;~  Global $hPen = _GDIPlus_PenCreate ()
    GUICtrlCreateLabel("Purchased At:", 20, $i * 30 + 10, 80, 30)
    GUICtrlCreateInput("2", 90, $i * 30 + 8, 100, 24)
;~  GuiCtrlSetData(-1, $CurrentBudgetInfoLocation[$i])
GuiCtrlCreateLabel("Cost:", 210, $i * 30 + 10, 80,30)
GuiCtrlCreateInput("2", 240, $i * 30 + 8,100,24)
;~  GuiCtrlSetData(-1, $CurrentBudgetInfoSpentAmount[$i])
_GDIPlus_GraphicsDrawLine ($hGraphic, 342, $YAlignment+8, 380, $YAlignment+8, $hPen)
$YAlignment += 30
Next
GuiCtrlCreateLabel("Total:", 402,312, 120,30)
GuiCtrlCreateInput("2", 435, 308,100,24)
;~  GuiCtrlSetData(-1, $CurrentBudgetTotal)
;~  _GDIPlus_GraphicsDrawLine ($hGraphic, 380, 49, 380, $YAlignment-22, $hPen)
;~  _GDIPlus_GraphicsDrawLine ($hGraphic, 380, 318, 400, 318, $hPen)
GuiCtrlCreateLabel("Variance:", 550,312, 120,30)
GuiCtrlCreateInput("2", 600, 308,100,24)
;~  GuiCtrlSetData(-1, $VarianceBudgetTotal)
;~  
$EditTab = GUICtrlCreateTabItem("Add to budget")
GuiCtrlCreateButton("Test", 300,300)
 
GUICtrlCreateTabItem("")
 
$iPic = GUICtrlCreatePic("", 340, 3, 50, 660)
_CreateLineImageToPic($hGui, $iPic)
 
Func _CreateLineImageToPic($hGui, $iPic)
    Local $aPos = ControlGetPos($hGui, "", $iPic)
    _GDIPlus_Startup()
    Local $hImage = _GDIPlus_BitmapCreateFromScan0($aPos[2], $aPos[3])
    Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
    Local $hPen = _GDIPlus_PenCreate(0xFF0000FF, 2)
    Local $hEndCap = _GDIPlus_ArrowCapCreate(3, 6)
;~     _GDIPlus_GraphicsDrawLine($hGraphics, $aPos[2] / 2, 58 - $aPos[1], $aPos[2] / 2, 8 * 40 + 18 - $aPos[1], $hPen)
    For $i = 1 To 21
        _GDIPlus_GraphicsDrawLine($hGraphics, 0, $i * 40 + 8 - $aPos[1], $aPos[2] / 2, $i * 40 + 8 - $aPos[1], $hPen)
    Next
    _GDIPlus_PenSetCustomEndCap($hPen, $hEndCap)
;~     _GDIPlus_GraphicsDrawLine($hGraphics, $aPos[2] / 2, (8 * 40 + 36 - $aPos[1]) / 2, $aPos[2], (8 * 40 + 36 - $aPos[1]) / 2, $hPen)
    Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap))
    _WinAPI_DeleteObject($hBitmap)
    _GDIPlus_ArrowCapDispose($hEndCap)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hImage)
    _GDIPlus_Shutdown()
EndFunc   ;==>_CreateLineImageToPic
 
Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[6]
EndFunc   ;==>_GDIPlus_BitmapCreateFromScan0
 
 
 
 
While 1
    Sleep(10)
WEnd
 
Func _Exit()
_GDIPlus_PenDispose ($hPen)
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_Shutdown ()
    Exit
EndFunc

The first and last boxes are okay, but the rest are off.

Edited by Damein

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

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