Snippets

SeanB dynamic objects

Created by SeanB last modified
Procedure BuildBooksGrid
    Integer iSize iWidth iHeight iColumns iRows iColumn iRow
    Integer iElement iImageContainerSize iCurrentRows iCurrentColumns
    Integer iTilesWidth iTilesHeight iTilesMargin iGap
    Handle[] hoTilesCollection
    Handle hWnd hoVoid
    Boolean bUseBlackBackground bShowThumbnails bShowScrollBars

    Set Visible_State to False
    
    // Destroy all 
    Send DestroyAllChilds
    
    Get Size of oContainer3d1 to iSize
    Get piTilesHeight to iTilesHeight
    Get piTilesWidth  to iTilesWidth
    Get piTilesMargin to iTilesMargin 

    Move (Low (iSize)) to iWidth
    Move (Hi (iSize)) to iHeight

    Move ((iWidth - (iTilesMargin * 2)) / (iTilesWidth + iTilesMargin)) to iColumns
    Move ((iHeight - (iTilesMargin * 2)) / (iTilesHeight + iTilesMargin)) to iRows

    For iRow from 1 to iRows
        For iColumn from 1 to iColumns
        
            Move (SizeOfArray (hoTilesCollection)) to iElement
            Get Create (RefClass (Button)) to hoTilesCollection[iElement]
            Set Size of hoTilesCollection[iElement] to iTilesHeight iTilesWidth
            Set Location of hoTilesCollection[iElement] to ((iRow - 1) * (iTilesHeight + iTilesMargin) + iTilesMargin + iGap) ((iColumn - 1) * (iTilesWidth + iTilesMargin) + iTilesMargin)
            Set Label of hoTilesCollection[iElement] to ("L" + String(iElement))
            Set psToolTip of hoTilesCollection[iElement] to ("Livro " + String(iElement))
            
        Loop
    Loop
    
    Broadcast Send Page_Object 1
    Set Visible_State to True 
    
    Show ("Created: " + String(iElement + 1))
    Set phoTilesCollection to hoTilesCollection
End_Procedure

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.