Luigi Posted November 7, 2014 Share Posted November 7, 2014 (edited) Hi Forum, I need check if this code is write... That is the fun... You have a number of items, and need display all in an Array... The line numbers is unknow... The columns number is determinate... So.. how determinate the number of lines? Local $iQuant = 8 Local $aCell[2] = [0, 4] ; number of lines and colunmns For $ii = 1 To $iQuant If Not Mod($ii, $aCell[1]) And $iQuant > $ii Then $aCell[0] += 1 Next ConsoleWrite("$iLin->" & $aCell[0] & @LF) ConsoleWrite("$iCol->" & $aCell[1] & @LF) $iQuant determine the number of itens... $aCell is the array, it contaim the number of lines and columns, respective to show elements... See, $aCell[0] start with 0 lines, but, $aCell[1] have 4 columns... So, you have a array with 4 columns and 'n' lines... If I have $iQuant = 3, my $aCell is [0, 4], ok? If I have $iQuant = 4, my $aCell is [0, 4], ok? If I have $iQuant = 5, my $aCell is [1, 4], ok? If I have $iQuant = 8, my $aCell is [1, 4], ok? If I have $iQuant = 9, my $aCell is [2, 4], ok? This algorithm to show the number of elments, with pre-determinad number of columns ir write? Have any bug? Someone have a better way to build this? Thanks for any help Br, Detefon Edited November 7, 2014 by Detefon Visit my repository Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 7, 2014 Moderators Share Posted November 7, 2014 (edited) Where are you pulling your info from, what type of application? With the references to $aCell I'm guessing Excel? Edited November 7, 2014 by JLogan3o13 "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 More sharing options...
Luigi Posted November 7, 2014 Author Share Posted November 7, 2014 Hi JLogan3o13, this is my application, $aCell is random name. The scope of this is, I have a number of small applications to show for end user, I want show all this info in a gui, with lines and rows. Each line have a certain number of columns, I call cells. Each cell is a small aplication, similar windows control panel and your icons... This algorithm it is to calculate how many lines and columns I need to show a determinate number of applications, to build this grid or something like this. Visit my repository Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 7, 2014 Moderators Share Posted November 7, 2014 Detefon,This little calculation seems to be what you need: For $i = 1 To 25 $iRows = Floor(($i - 1) / 4) ; How many 4's are there to fit in? ConsoleWrite($i & ": [" & $iRows & ", 4]" & @CRLF) NextM23 Luigi 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Solution Luigi Posted November 7, 2014 Author Solution Share Posted November 7, 2014 (edited) I made this little change... Local $iQuant = 5 ; number of apps to show Local $aCell[2] = [0, 4] ; $aCell[0] is unknow number of lines ; $aCell[1] is know number of columns $iRows = Floor(($iQuant - 1) / $aCell[1]) ; How many 4's are there to fit in? ConsoleWrite("[" & $iRows & ", " & $aCell[1] & "]" & @CRLF) I do not need itereate all elements, I need know how many lines is necessary to show "n" elments in an array with determinate number of columns... Your code show this in one line, and more easy to understand than mine first code... Both work fine, your is more easy. Thank you again. Br, Detefon Edited November 7, 2014 by Detefon Visit my repository Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now