Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

A Question about DDT, SetParent and Messages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • A Question about DDT, SetParent and Messages

    Hi all,

    this time I'd like to ask following question from you more seasoned PB/DLL programmers.

    I have a DDT created dialog where I add Image controls. However, I like to have these image controls inside another control (which I think VB programmers know as Panel). I do all this in following code

    Code:
        ' Add container window for bitmaps
        CONTROL ADD LABEL, hDlg, %CONTAINER, "", 5, 15, 150, 20 , %WS_THICKFRAME OR %SS_NOTIFY
        CONTROL HANDLE hDlg, %CONTAINER TO hWndBrowse
    	    
        ' Add image controls for the bitmaps
        FOR i = %FIRST_BMP TO %LAST_BMP
            sBmp = "#"+TRIM$(STR$(i))
            CONTROL ADD IMAGE,  hDlg, i, sBmp, _
                                0, 0,16,16, _
                                %WS_TABSTOP OR %SS_NOTIFY
            CONTROL HANDLE hDlg, i TO hWndTemp
            SetParent hWndTemp, hWndBrowse
            MoveWindow hWndTemp, 5 + (i - %FIRST_BMP) * 18, 5, 16, 16, %TRUE
        NEXT
    That works OK.

    Now the problem to me is how to intercept the messages these Image controls send?

    If I comment out SetParent and MoveWindow statements following code does what I want

    Code:
    	SELECT CASE CBMSG
           CASE %WM_COMMAND
                SELECT CASE CBCTL
                    CASE %FIRST_BMP TO %LAST_BMP
                         IF CBCTLMSG = %STN_CLICKED THEN
                            IF iSelected > 0 THEN
                                CONTROL SET IMAGE CBHNDL, iSelected, "#"+TRIM$(STR$(iSelected))
                            END IF
                            iSelected = CBCTL
                            CONTROL SET IMAGE CBHNDL, CBCTL, _
                                              "#"+TRIM$(STR$(iSelected + nOffsetToHilightedBmps))
                         END IF
     
                    ' Other cases
     
                END SELECT
        END SELECT
    Can anybody give me some advice how to approach this in case I have changed the parent window of Image controls? I'd like to continue using DDT when creating the dialog.

    TIA
    Lasse Rantanen
    [email protected]

  • #2
    Once again, too complicated approach. The way to achieve what I was after is to use LINE control supplied, no need for SetParent and stuff. So - ignore this question.

    Sorry about wasting bandwidth,

    Lasse Rantanen
    [email protected]



    ------------------

    Comment

    Working...
    X