Author Topic: Why I choose SDK over anything else  (Read 65849 times)

0 Members and 1 Guest are viewing this topic.

Chris Boss

  • Guest
Re: Why I choose SDK over anything else
« Reply #45 on: January 14, 2011, 08:31:00 PM »
I don't see any real problems in dealing with DDT created Dialogs. A window is a window, no matter how it is created.

The API provides all the necessary functions to convert between Dialog Units and Pixels.

When drawing into a Dialog or its controls, any common DC passed from Windows (ie. GetDC) will have the default set to MM_TEXT which is basically pixel mode, so drawing should not be a problem.

I don't see what the problem is here.

DDT is simply a high level wrapper over the Windows Dialog API's, so it isn't doing anything out of the ordinary.

EZGUI uses Dialogs too, except I use a Custom Dialog class, rather than the default class in Windows. Even though internally the API's called require Dialog units for the Dialog (Form) everything else is done using pixels internally. Even controls are created using CreateWindowEx, rather than define them in a Dialog Template.

The mixing of Dialogs which use Dialog Units and the Windows API is not all that difficult. If WinLift can skin an EZGUI app, I see no reason it can't skin a DDT app.

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 965
    • it-berater
Re: Why I choose SDK over anything else
« Reply #46 on: January 14, 2011, 09:18:27 PM »
I agree 100% with Chris here. A window is .. a window is .. a window.
Thats what i say. I create a Dialog with DDT and use API to size, to move it, to make invisible or enable it.
I get the CONTROL HANDLE TO h& ... and the Power is mine.

Or lets say like this: I pledge for taking out the best of both worlds.
And of course i vote for a DDT Design thats as much upwards (API-) compatible as possible.

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2022
    • www.zapsolution.com
Re: Why I choose SDK over anything else
« Reply #47 on: January 14, 2011, 09:36:43 PM »
.NET doesn't use twips anymore.

Nowdays, people are using LCD display, and they use them at their highest possible resolution. Well behaved interfaces should be based on anchor properties to change the size and location of child controls when the main window is resized.

Example of anchor properties:
http://www.jose.it-berater.org/smfforum/index.php?topic=3655.msg11844#msg11844

...
 
« Last Edit: January 14, 2011, 10:15:47 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2022
    • www.zapsolution.com
Re: Why I choose SDK over anything else
« Reply #48 on: January 14, 2011, 09:40:16 PM »
WinLIFT skins DDT perfectly, that is not the problem.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2022
    • www.zapsolution.com
Re: Why I choose SDK over anything else
« Reply #49 on: January 14, 2011, 09:45:36 PM »
Theo,

Quote
CONTROL HANDLE TO h&

Try to use cut and past of the DDT syntax into C++ or WinDev, and you will understand why i stay with the strict API syntax.

...
« Last Edit: January 14, 2011, 10:06:33 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 965
    • it-berater
Re: Why I choose SDK over anything else
« Reply #50 on: January 14, 2011, 10:15:46 PM »
I have downloaded the WINDEV Demo last time when you recomended ist.
I tried 15 Minutes but i did not understand a thing about it.
Maybe I'd first need a cours of 1-2 days how to make the first steps using WinDev - it like another world to me.

Actually I use only PureBasic for x64 and PowerBasic for Programming.
And of course: WinRobots for Scripting.

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2022
    • www.zapsolution.com
Re: Why I choose SDK over anything else
« Reply #51 on: January 14, 2011, 10:25:32 PM »
Theo,

I am not in favor of C++, nor of WinDev, it is just that they are the largest programming platforms.

Tooks me three monthes to get comfortable with the WinDev concept, however i can tell you that i can do things with it, in a fraction of the time it would take me with any other tool.

It is not perfect, not as fast as PowerBASIC, however you can write very large project with it, and it follows the industry standard.

And if you want, you can even write code with it, like this:

Code: [Select]
wc.cbSize = Dimension(wc)
IsInitialized is int =  GetClassInfoEx(Instance, zClass, wc)
IF IsInitialized = 0 THEN
  wc.style         = wcStyle
  wc.lpfnWndProc   = &WndProc
  wc.cbClsExtra    = 0
  wc.cbWndExtra    = 0 // Extend_cbWndExtra * 4
  wc.hInstance     = Instance
  wc.hIcon         = Null//API(USER32, "LoadImageA", Null, "GoldFish.ico", 1, 0, 0, 0x00000010 + 0x00000040)
  wc.hCursor       = API(USER32, "LoadCursorA", Null, IDC_ARROW)
  wc.hbrBackground = Null
  wc.lpszMenuName  = Null
  wc.lpszClassName = &zClass
  wc.hIconSm       = Null
  IF RegisterClassEx(wc) THEN IsInitialized = True
END

IF IsInitialized THEN
  x = Max((GetSystemMetrics(SM_CXSCREEN) - MyWindow..Width) / 2, 0)
  y = Max((GetSystemMetrics(SM_CYSCREEN) - MyWindow..Height) / 2, 0)
  w = MyWindow..Width
  h = MyWindow..Height
  dwStyle = WS_POPUP|WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_VISIBLE
  
  hMain is int = CreateWindowEx(  0,          // SDK extended style
  zClass,       // Set this one to your default path name
  MyWindow..Caption,  // Caption
  dwStyle,      // SDK style
  x,          // X location
  -2000,        // Y location
  w,          // Width
  h,          // Height
  0,          // Parent handle
  0,          // Control ID
  Instance,     // Instance
  0)
  IF hMain THEN
      
    SetStaticValue("hMain", hMain)
    
    // Create the GDImage graphic control
    hImageCtrl is int = CreateWindowEx( 0,
    GDImageClassName,
    "",
    WS_CHILD|WS_VISIBLE,
    GraphicControl..X,
    GraphicControl..Y,
    GraphicControl..Width,
    GraphicControl..Height,
    hMain,
    IDC_MAIN_GDIMAGE,
    Instance,
    0)

    // Change the WinLIFT skin theme here:
    sTheme is string
    sTheme = ExePath() + "Naavi.sks"
    
    IF skInitEngine(sTheme, "") THEN
      skSkinWindow(hMain, "Dock|Undock|Minimize|Maximize|Restore|Close")

      // Load animated background.
//      gsUsePlugin = gsPluginPath + "HUD_Beam.dll"
      gsUsePlugin = gsPluginPath + "HUD_Vortex.dll"
      ExeRun(ExePath() + "ZWP.exe " + gsUsePlugin, exeInactive)
      apiSleep(200)
      
      GetWindowRect(hMain, lpw)
      NewW = lpw.nRight - lpw.nLeft
      NewH = lpw.nBottom - lpw.nTop
      
      IF hImageCtrl THEN
        SetStaticValue("hImageCtrl", hImageCtrl)
        skSetAnchorCtrl(hImageCtrl, ANCHOR_HEIGHT_WIDTH)
        // Add a skinned border around the GDImage control.
        skBorder(hImageCtrl, GraphicControl..X - 1, GraphicControl..Y - 1, GraphicControl..Width + 2, GraphicControl..Height + 2, 0, 1)
      END
      
      // Create and skin the zoom slide control.
      IF SplitTemplate(SlideZoom..Name, x, y, w, h, "", "", 0) THEN
        dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | TBS_VERT | TBS_BOTTOM | TBS_AUTOTICKS
        hCtrl = CreateWindowEx(0, "MSCTLS_TRACKBAR32", "", dwStyle, x, y, w, h, hMain, IDC_MAIN_SLIDEZOOM, Instance, 0)
        skSkinChildCtrl(hCtrl, 0)
        skSetAnchorCtrl(hCtrl, ANCHOR_RIGHT)
        SetStaticValue("HWND_MAIN_SLIDEZOOM", hCtrl)
      END
      
      IF SplitTemplate(BTNSELECT..Name, x, y, w, h, sLabel, sImagePath, dwStyle) THEN
        hCtrl = skButtonImage(hMain, sImagePath, x, y, IDC_MAIN_LOADIMAGE, 5)
        skSetAnchorCtrl(hCtrl, ANCHOR_BOTTOM_RIGHT)
        skCreateTooltip(hCtrl, "WinLIFT ButtonImage")
      END  
      
      // Create and skin the check box composited button.
      IF SplitTemplate(CheckComposited..Name, x, y, w, h, "", "", 0) THEN
        sLabel = "Transparent HUD mode"
        dwStyle = WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX|BS_LEFT|BS_TOP
        hCtrl = CreateWindowEx(0, "BUTTON", sLabel, dwStyle, x, y, w, 18, hMain, IDC_MAIN_CHECKBOX, Instance, 0)
        skSkinChildCtrl(hCtrl, 0)
        skSetAnchorCtrl(hCtrl, ANCHOR_CENTER_HORZ_BOTTOM)
        ZI_UseWinLIFTbackground(hImageCtrl, True, False)
      END
      
      // Create WinLIFT ClockControl, based on template.
      IF SplitTemplate(Clock..Name, x, y, w, h, sLabel, sImagePath, dwStyle) THEN
        hCtrl = skClockCtrl(hMain, sImagePath, x, y, 0, 0, IDC_MAIN_CLOCK, 0x7FCB0000, 0x7F8F8F8F, 0)
        // Anchor the button to bottom left.            
        skSetAnchorCtrl(hCtrl, ANCHOR_BOTTOM)
        skCreateTooltip(hCtrl, "WinLIFT clock control")
      END
      // Create WinLIFT LeftKnobControl, based on template.
      IF SplitTemplate(KnobLeft..Name, x, y, w, h, sLabel, sImagePath, dwStyle) THEN
        hCtrl = skKnobGauge(hMain, (sImagePath), x, y, 0, 0, IDC_MAIN_KNOBLEFT, 0, 0, 0, 0)
        // Anchor the button to bottom left.            
        skSetAnchorCtrl(hCtrl, ANCHOR_CENTER_HORZ_BOTTOM)
        skCreateTooltip(hCtrl, "WinLIFT knob gauge")
        SetStaticValue("HWND_MAIN_KNOBLEFT", hCtrl)
      END
      // Create WinLIFT LeftKnobControl, based on template.
      IF SplitTemplate(KnobBig..Name, x, y, w, h, sLabel, sImagePath, dwStyle) THEN
        hCtrl = skKnobGauge(hMain, (sImagePath), x, y, 0, 0, IDC_MAIN_KNOBBIG, 0, 0, 0, 0)
        // Anchor the button to bottom left.            
        skSetAnchorCtrl(hCtrl, ANCHOR_CENTER_HORZ_BOTTOM)
        skCreateTooltip(hCtrl, "WinLIFT knob gauge")
        SetStaticValue("HWND_MAIN_KNOBBIG", hCtrl)
      END
      // Create WinLIFT RightKnobControl, based on template.
      IF SplitTemplate(KnobRight..Name, x, y, w, h, sLabel, sImagePath, dwStyle) THEN
        hCtrl = skKnobGauge(hMain, (sImagePath), x, y, 0, 0, IDC_MAIN_KNOBRIGHT, 0, 0, 0, 0)
        // Anchor the button to bottom left.            
        skSetAnchorCtrl(hCtrl, ANCHOR_CENTER_HORZ_BOTTOM)
        skCreateTooltip(hCtrl, "WinLIFT knob gauge")
        SetStaticValue("HWND_MAIN_KNOBRIGHT", hCtrl)
      END

      // Create and skin the check box visual plugin button.
      IF SplitTemplate(SEL_Plugin..Name, x, y, w, h, "", "", 0) THEN
        sLabel = "Vortex"
        h = h / 2
        dwStyle = WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTORADIOBUTTON|BS_LEFT|BS_TOP
        hCtrl = CreateWindowEx(0, "BUTTON", sLabel, dwStyle, x, y, w, 18, hMain, IDC_VORTEX, Instance, 0)
        SendMessage(hCtrl, BM_SETCHECK, BST_CHECKED, 0)
        skSkinChildCtrl(hCtrl, 0)
        skCreateTooltip(hCtrl, "Visual plugin")
        skSetAnchorCtrl(hCtrl, ANCHOR_CENTER_HORZ_BOTTOM)

        sLabel = "Laser beam"
        dwStyle = WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTORADIOBUTTON|BS_LEFT|BS_TOP
        hCtrl = CreateWindowEx(0, "BUTTON", sLabel, dwStyle, x, y + h, w, 18, hMain, IDC_LASER_BEAM, Instance, 0)
        skSkinChildCtrl(hCtrl, 0)
        skCreateTooltip(hCtrl, "Visual plugin")
        skSetAnchorCtrl(hCtrl, ANCHOR_CENTER_HORZ_BOTTOM)  
      END

      // Create and skin the check box visual plugin button.
      IF SplitTemplate(CheckPlugin..Name, x, y, w, h, "", "", 0) THEN
        sLabel = "Visual plugin"
        dwStyle = WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX|BS_LEFT|BS_TOP
        hCtrl = CreateWindowEx(0, "BUTTON", sLabel, dwStyle, x, y, w, 18, hMain, IDC_MAIN_PLUGIN, Instance, 0)
        skSkinChildCtrl(hCtrl, 0)
        skCreateTooltip(hCtrl, "Enable/disable visual plugin")
        skSetAnchorCtrl(hCtrl, ANCHOR_CENTER_HORZ_BOTTOM)
      END
      
      // Start with the default picture.
      sResource is string = ExePath() + "Resource\"
      sUsePhoto is string = sResource + "Naavi.png"
      UseThisPhoto(sUsePhoto)
      
      // Add a transparent logo on the top right corner.
      sUsePhoto = sResource + "GDImage.png"
      // Load image and retrieve the width and height of its bitmap.
      hBitmap is int = ZI_CreateBitmapFromFile(sUsePhoto, w, h)
      // Use the new hBitmap to create a sprite image on the top right corner.
      ZD_DrawBitmapToCtrl(hImageCtrl, GraphicControl..Width - (w + 10), 10, hBitmap, ZD_ColorARGB(255, 0), ID_LOGO, ZS_VISIBLE)
      // Anchor the logo to the top right corner.
      ZD_SetObjectAnchorMode(ID_LOGO, ANCHOR_RIGHT)
      // Lock and disable the sprite image.
      ZD_SetObjectLocked(ID_LOGO, True)                
    END
    
    ShowWindow(hMain, SW_SHOW)
    
    // Create a fall down effect animation.
    x = Max((GetSystemMetrics(SM_CXSCREEN) - MyWindow..Width) / 2, 0)
    y = Max((GetSystemMetrics(SM_CYSCREEN) - MyWindow..Height) / 2, 0)
    w = MyWindow..Width
    h = MyWindow..Height
    dwStyle = RDW_INVALIDATE|RDW_INTERNALPAINT|RDW_ERASE|RDW_ERASENOW|RDW_UPDATENOW|RDW_ALLCHILDREN|RDW_FRAME
    ShowWindow(hImageCtrl, 0)
    FOR k = -h TO -1  STEP 8
      MoveWindow(hMain, x, k, w, h, 1)
      RedrawWindow(hMain, Null, 0, dwStyle)
    END
    ShowWindow(hImageCtrl, SW_SHOW)
    FOR k = 0 TO y
      MoveWindow(hMain, x, k, w, h, 1)
      RedrawWindow(hMain, Null, 0, dwStyle)
    END
    ShowWindow(hMain, SW_HIDE)
    x = Max((GetSystemMetrics(SM_CXSCREEN) - NewW) / 2, 0); y = Max((GetSystemMetrics(SM_CYSCREEN) - NewH) / 2, 0)
    MoveWindow(hMain, x, y, NewW, NewH, 0)
    ShowWindow(hMain, SW_SHOW)

  
    // Main message pump.  
    WHILE GetMessage(Msg, Null, 0, 0)
      TranslateMessage(Msg)
      DispatchMessage(Msg)
    END


      WP_Destroy()
    
    nRet is int = Msg.wParam    

 ;D
« Last Edit: January 14, 2011, 10:35:14 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Bob Zale

  • Newbie
  • *
  • Posts: 39
Re: Why I choose SDK over anything else
« Reply #52 on: January 15, 2011, 12:30:38 AM »
.NET doesn't use twips anymore.

That may be true, but twips have nothing to do with Dialog Units.  A twip is simply:   Inch / 1440.  No more.  No less.

Bob

Chris Boss

  • Guest
Re: Why I choose SDK over anything else
« Reply #53 on: January 15, 2011, 03:44:59 AM »
Quote
Well behaved interfaces should be based on anchor properties to change the size and location of child controls when the main window is resized.

I agree, which is why I added this feature to EZGUI 5.0.

Just a comment about dot.net ...

Dot.net is in a sense a "wrapper" over the Windows API. WinForms in dot.net (and WPF) are wrappers over the API to supposedly make programming easier. I was reading some interesting articles lately, and IMO Microsoft has simply been trying different wrappers over the API over the years simply because they felt working with the API directly was to difficult. Thats why they created MFC. WinForms (in dot.net) was suppose to replace MFC. WPF is suppose to replace WinForms from what I have read.

The point is that Microsoft keeps trying to add layers to the operating system to supposedly make programming easier.

If Microsoft can build wrappers over the API to make things easier, I don't see why DDT should be viewed any differently. Obviously pure SDK style coding is not what Microsoft feels is best. They wrote Windows and they feel working purely at the API level is not easy.

I may have taken a different approach from Powerbasic on how to design a higher level wrapper over the API, but I agree with them that such a set of wrappers is necessary for PB.


Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2022
    • www.zapsolution.com
Re: Why I choose SDK over anything else
« Reply #54 on: January 15, 2011, 09:38:16 AM »
Quote
A DLU is based on the size of the dialog box font, normally 8-point MS Sans Serif. A horizontal DLU is the average width of the dialog box font divided by four. A vertical DLU is the average height of the font divided by eight.

I want my button to be 20 dialog units from the top, and 8 d.u. from the left.
After resize, WM_SIZE gives you the size in pixels, with d.u. to get the position right, the values need to be scalled, and this means extra computation.
With modern Themed interface, DLU has been left out in favor of the use of pixels and anchor properties.

I have even added myself anchor properties inside of my graphic GDImage control, to allow the resizing of sprites and widget, on the same principle than Visual Studio and WinDev are doing for child controls when designing a new interface. Indeed a GDImage control could be used to build a complete interface, because there is no difference between a window and a GDImage graphic layer object.


Chris,
Quote
If Microsoft can build wrappers over the API to make things easier, I don't see why DDT should be viewed any differently.
Because they are Microsoft.
Now ask yourself what would happen to your users the day you are out of buisiness.
And if they want to get retired, do you think they will be able to sell their source code to anybody else?

When you write DLLs to achieve specific tasks, things are different, because if GDImage or WinLIFT come to an end, you will always find other DLLs to replace them, but what if the runtime itself disappear.

Only Microsoft can take the decision to stop VB without too much prejudice for themselves, but for their users it was an extreme prejudice.

This is the main reason "Why i choose SDK over anything else"  ;D


...

« Last Edit: January 15, 2011, 03:43:51 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Bob Zale

  • Newbie
  • *
  • Posts: 39
Re: Why I choose SDK over anything else
« Reply #55 on: January 15, 2011, 11:02:01 AM »
Microsoft designs code wrappers - That is good.
Microsoft designs Dialog Units - That is good.
PowerBASIC uses Microsoft-Designed Dialog Units as one option - That is bad.

Is there some problem with this logic?

Bob Zale

Offline Bob Zale

  • Newbie
  • *
  • Posts: 39
Re: Why I choose SDK over anything else
« Reply #56 on: January 15, 2011, 11:13:04 AM »
I want my button to be 20 dialog units from the top, and 8 d.u. from the left.

Here's the secret ingredient...   Call GetClientRect() on the dialog in question (That's a Windows API function for those not familiar).  It returns the size of the Dialog Client Area in pixels.  Use that size as the basis for everything else you do on that dialog for the duration of the program.  You never, ever have to use Dialog Units for any other purpose.  Not even once.

Of course, if you do this, you won't be able to complain about PowerBASIC. <<g>>  That would be really disappointing!

Bob Zale
PowerBASIC Inc.


Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2022
    • www.zapsolution.com
Re: Why I choose SDK over anything else
« Reply #57 on: January 15, 2011, 11:39:09 AM »
Bob,

I like your compiler, and i wrote many times that it is my favorite one.

However, i feel free to express myself in my dedicated section, and people coming here are also free to express their own.

PB10 seems to have some very nice new features, and i hope that 64-bit will be next on the list.

...



« Last Edit: January 15, 2011, 12:03:10 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Mike Mayerhoffer

  • Newbie
  • *
  • Posts: 17
Re: Why I choose SDK over anything else
« Reply #58 on: January 15, 2011, 12:44:56 PM »
quote ----IF pixel would have been the default then i probably wouldn't care.

You can make a DDT program. Starting with DIALOG NEW PIXELS, hParent, "Dialog1", 520, 262, 302, 197, TO hDlg  Have all your children in pixels as well. So it is an option with DDT to use DLG units or Pixels....    ???

Beside rather than beating up DDT ask for a CreateWindow - CreateWindowEx DCWT wrapper or something and present the positive reasonings.
Why it should be put in PB and the benefits you feel.

Or make your own wrapper ?


Or make a ddt to CreateWindow  tool.... you would have to fill in a few blanks after the conversion would save a lot of time no ?
 

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 965
    • it-berater
Re: Why I choose SDK over anything else
« Reply #59 on: January 15, 2011, 01:04:31 PM »
I like that Bob follows our discussion, but i really prefer to hear something from him about PB 10.
To me it doesn't make sense to warm up the old discussion about the "Kings beared" once more.

While he could tell us news about PB 10 and when he believe it could be available!

@Bob i hope you enjoy the staying in Jose's Forum and use it for your relaxation and to collect new power for the big thing you have in the box in front of yours. Which is hopefully soon ready.

Because we all know there are many out there waiting for it to be available.
And they hope it will be as good and as stable and as bug free as any PB Version before.

Which is going to be difficult if not impossible,
 because i believe that this time we will be having the most complex PowerBasic ever!

About the wrappers. Thanks Jose, they will be available. Take a look, thousand of them!
http://www.jose.it-berater.org
« Last Edit: January 15, 2011, 01:08:20 PM by Theo Gottwald »