Announcement

Collapse
No announcement yet.

The DDT improvements topic

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

  • The DDT improvements topic

    This topic should be used to make suggestions regarding DDT, i'll make a few posts but i have much more thoughts on how the PB's formengine should be.
    In time we'll come to that.
    It's pointless to discuss work-arounds, we know them all by now.

    At first i'll show some of the things which imo should be changed, it's possible PB does not change the current DDT due its impact it would have, maybe we can establish a newer form engine named Window... instead of Dialog...

    Here are a few things wich imo should be changed.

    1)
    First the callback procedure is provided during the show modal or modeless call.
    This is not common and the callback should be set during form creation at least.
    This would also make a better behaviour since in it's initial state a different windowprocedure is set, once the dialog show calls + callback are executed, a new dialog procedure is set.
    This confuses the programmer + not all messages are now passed.
    The use of a callback may still be optional, it's not related.

    2)
    The windowstyle WS_VISIBLE has no meaning for DDT.
    A secundairy call like dialog show... or whatever 'show' API is required to show the dialog.
    The style should work right away.
    Even more.. i can not create hidden forms if i want to make it my main form shown modal.
    Think of a tray application.
    Briefly show the main form is hobby.

    3)
    My example below shows a design flaw regarding the WM_INITDIALOG message, this message will never be invoked twice by Windows, but it is executed twice by the DDT engine in this case.
    By following step #1 and #2 this could have been prevented.
    This code shows that this message is called twice, the 2nd could have been stopped.
    Often people tend to create the controls inside this message, while i find this a bad idea.. it happens, code may be executed twice, this is not good.

    Removing the callback from the modal part does not prevent this as well, since it discards the custom callback from the dialog.

    ---

    The messagepump should barely be related to the form, it's a secundairy step in the process, as it is right now it makes to much part of the form(-creation).
    Later on i'll discuss the messagepump.

    Code:
    [color=#7F007F]%ID_FORM1_TEXT1[/color] = 100
    [color=#7F007F]%ID_FORM1_BUTTON1[/color] = 101
    
    [color=#0000FF]CallBack[/color] [color=#0000FF]Function[/color] Form1_Proc
    
        [color=#0000FF]Select[/color] [color=#0000FF]Case[/color] [color=#0000FF]CbMsg[/color]
        [color=#0000FF]Case[/color] [color=#7F007F]%WM_INITDIALOG[/color]
        
            [color=#0000FF]MsgBox[/color] "WM_INITDIALOG"
    
        [color=#0000FF]Case[/color] [color=#7F007F]%WM_COMMAND[/color]
    
            [color=#0000FF]Select[/color] [color=#0000FF]Case[/color] [color=#0000FF]CbCtl[/color]
            [color=#0000FF]Case[/color] [color=#7F007F]%ID_FORM1_BUTTON1[/color]
    
                [color=#0000FF]Select[/color] [color=#0000FF]Case[/color] [color=#0000FF]CbCtlMsg[/color]
                [color=#0000FF]Case[/color] [color=#7F007F]%BN_CLICKED[/color]
                    [color=#0000FF]MsgBox[/color] "CLICK"
                [color=#0000FF]End[/color] [color=#0000FF]Select[/color]
            [color=#0000FF]End[/color] [color=#0000FF]Select[/color]
            
        [color=#0000FF]Case[/color] 10000
    
            [color=#0000FF]Control[/color] [color=#0000FF]Set[/color] [color=#0000FF]Text[/color] [color=#0000FF]CbHndl[/color], [color=#7F007F]%ID_FORM1_TEXT1[/color], [color=#0000FF]Time$[/color]        
        
        [color=#0000FF]End[/color] [color=#0000FF]Select[/color]
    
    [color=#0000FF]End[/color] [color=#0000FF]Function[/color]
    
    [color=#0000FF]Function[/color] Test() [color=#0000FF]As[/color] [color=#0000FF]Long[/color]
    
        [color=#0000FF]Local[/color] hDlg [color=#0000FF]As[/color] [color=#0000FF]Long[/color]
    
        [color=#0000FF]Dialog[/color] [color=#0000FF]New[/color] [color=#0000FF]Units[/color], 0, "title$", , , 200, 200, [color=#7F007F]%WS_SYSMENU[/color] [color=#0000FF]Or[/color] [color=#7F007F]%WS_VISIBLE[/color] [color=#0000FF]To[/color] hDlg
        
        [color=#0000FF]Control[/color] [color=#0000FF]Add[/color] "Edit", hDlg, 100, "Text1", 16, 10, 67, 21, [color=#7F007F]%WS_CHILD[/color] [color=#0000FF]Or[/color] [color=#7F007F]%WS_TABSTOP[/color] [color=#0000FF]Or[/color] [color=#7F007F]%WS_VISIBLE[/color] [color=#0000FF]Or[/color] [color=#7F007F]%ES_LEFT[/color] [color=#0000FF]Or[/color] [color=#7F007F]%ES_AUTOHSCROLL[/color], [color=#7F007F]%WS_EX_CLIENTEDGE[/color]
        [color=#0000FF]Control[/color] [color=#0000FF]Add[/color] "Button", hDlg, 101, "Button1", 16, 34, 67, 21, [color=#7F007F]%WS_CHILD[/color] [color=#0000FF]Or[/color] [color=#7F007F]%WS_TABSTOP[/color] [color=#0000FF]Or[/color] [color=#7F007F]%WS_VISIBLE[/color] [color=#0000FF]Or[/color] [color=#7F007F]%BS_NOTIFY[/color] [color=#0000FF]Or[/color] [color=#7F007F]%BS_CENTER[/color] [color=#0000FF]Or[/color] [color=#7F007F]%BS_VCENTER[/color] [color=#0000FF]Or[/color] [color=#7F007F]%BS_MULTILINE[/color], 0
    
        [color=#0000FF]Dialog[/color] [color=#0000FF]Show[/color] [color=#0000FF]Modeless[/color] hDlg, [color=#0000FF]Call[/color] Form1_Proc
    
        [color=#007F00]' Just something i would like to do..[/color]
        SendMessage( hDlg, 10000, 0, 0 )
        
        [color=#0000FF]Dialog[/color] [color=#0000FF]Show[/color] [color=#0000FF]Modal[/color] hDlg, [color=#0000FF]Call[/color] Form1_Proc
    
    [color=#0000FF]End[/color] [color=#0000FF]Function[/color]
    hellobasic
Working...
X