Jump to content

Refreshing labels


Go to solution Solved by Melba23,

Recommended Posts

Hi Guys,

I have the feeling this should be simple.... but then again "i am lost" :)

I create a series of input fields on a gui like:

 

For $i = 0 to $iTabelBreedte
    For $ii = 0 to $iTabelBreedte
       $oInvoer [$ii][$i] = GUICtrlCreateInput($aInvoer[$ii][$i], $iTabelxStart + $i*50, $yInvoerblok + $ii *25  , 45, 24)
       GUICtrlSetFont(-1, 11)
    Next
Next

 

It creates a box of input fields with $iTabelBreedte Rows and $iTabelBreedte columns

Now comes the question:

Say i generate through a button this table with 10 rows and 10 columns.

Then i Hit the button again, but this time i want the the grid to be 5 x 5.

The things is that it will leave (offcourse) the old rows and colums aswell. And the 5 x 5 will be drawn over the old ones

And i want a fresh table with only the 5 x 5 visible.

I don't care about if there was data in the rows and columns that need to dissappear (thats handled in the calculations)

But how to clean the input fields before i fill them again? 

I tried  things like:

$oInvoer [$ii][$i] = GUICtrlCreateInput("", 0,  0, 0,0)

and

$oInvoer [$ii][$i] ="" 

But no go ...(don't laugh at least i tried :) )

It is all done on a gui.

Any suggestions? Couldnt find an answer on the forum aswell, But maybe a use the wrong phrases to search.

Thanks A mill!! even for just reading!

 

 

Link to comment
Share on other sites

  • Moderators
  • Solution

WilliamWhite,

Does this help: ;)

#include <GUIConstantsEx.au3>

Global $oInvoer

$iTabelxStart = 10
$yInvoerblok = 10

$hGUI = GUICreate("Test", 515, 500)

; Picka starting size
$iTabelBreedte = Random(2, 10, 1)
; Draw the controls
_DrawControls($iTabelBreedte)

$cButton = GUICtrlCreateButton("Reload", 10, 450, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            ; Delete the existing controls
            For $i = 0 To $iTabelBreedte - 1
                For $ii = 0 To $iTabelBreedte - 1
                    GUICtrlDelete($oInvoer[$ii][$i])
                Next
            Next
            ; Pick a new number and draw them
            $iTabelBreedte = Random(2, 10, 1)
            _DrawControls($iTabelBreedte)
    EndSwitch

WEnd

Func _DrawControls($iNumber)

    Global $oInvoer[$iNumber][$iNumber]

    For $i = 0 To $iNumber - 1
        For $ii = 0 To $iNumber - 1
            $oInvoer[$ii][$i] = GUICtrlCreateInput($ii + ($i * 10), $iTabelxStart + $i * 50, $yInvoerblok + $ii * 25, 45, 24)
            GUICtrlSetFont(-1, 11)
        Next
    Next

EndFunc

Please ask if you have any questions. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

WilliamWhite.

 is it allowed to kiss a moderator?

My wife might object if you tried - but I will happily just accept the compliment! :D

Glad I could help. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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