NO

Author Topic: "MoveHalf" and "ResizeHalf" attributes for resizable dialogs  (Read 755 times)

Offline Snowman

  • Member
  • *
  • Posts: 54
"MoveHalf" and "ResizeHalf" attributes for resizable dialogs
« on: December 06, 2015, 11:13:11 AM »
I was pleased to see that making resizable dialogs with Pelles C is very easy: include resizer.h, link resizer.lib then add the attributes for "Vert resizing" and "Horz resizing" in the resource's dialog editor. So far so good.

The problem is that there are only 3 possible attributes: None, Resize and Move.

I would like there to also be attributes such as ResizeHalf and MoveHalf. These could have the effect of resizing or moving proportionally, specifically by half.

Now a bit off topic: I have noticed that there isn't much forum activity from Pelle so, assuming he won't read this Feature Request any time soon, I'd like to know where the source code for the resizer library is, thank you.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1555
Re: "MoveHalf" and "ResizeHalf" attributes for resizable dialogs
« Reply #1 on: December 06, 2015, 11:23:21 AM »
Installer put it in user's home dir to dir 'Pelles C Projects' ?
May the source be with you

Offline jj2007

  • Member
  • *
  • Posts: 441
Re: "MoveHalf" and "ResizeHalf" attributes for resizable dialogs
« Reply #2 on: December 06, 2015, 12:46:19 PM »
I am curious: Can you post a working example of such a dialog?

I have been experimenting with this idea, not in C, though - is the attached example more or less performing what you want to achieve?

GuiMenu equ @File, &Open, &Save, -, E&xit, @Edit, Undo, Copy, Paste
include \masm32\MasmBasic\Res\MbGui.asm

; attributes x, y, w and h expressed as 1/1000 of width resp height
GuiControl Ctrl1, "edit", w 400, h 200, text "first edit"
GuiControl Ctrl2, "edit", x 400, w 400, h 400, text "second edit"
GuiControl Ctrl3, "edit", x 800, w 200, h 600, text "third edit"
GuiControl Ctrl4, "static", y 200, w 400, h 800, text "static"
GuiControl Ctrl5, "listbox", x 400, y 400, w 400, h 600, text "listbox"
GuiControl Ctrl6, "button", x 1000-80, y 1000-30, w 0+80, h 0+30, text "button"      ; fixed size button

StringToArray cfm$("This\nis\na\nlistbox"), my$()
SetListbox my$()

Event Message
  SetWin$ hCtrl4=Cat$(fTime$(0)+Str$(", %4f hours since the last boot", Timer/3600000))

GuiEnd

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1555
Re: "MoveHalf" and "ResizeHalf" attributes for resizable dialogs
« Reply #3 on: December 07, 2015, 11:08:21 AM »
Quote
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <resizer.h>
#include "DlgTest1.h"

LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
   return ResizableDialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)MainDlgProc);
}

LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
   switch (uMsg)
   {
      case WM_INITDIALOG:
         return TRUE;
      case WM_CLOSE:
         EndDialog(hwndDlg, 0);
         return TRUE;
   }
   return FALSE;
}
Quote
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 6.50".
#include <windows.h>

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

1001 DIALOGEX DISCARDABLE 6, 18, 210, 142
STYLE DS_SHELLFONT|WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "Dialog"
FONT 8, "Tahoma", 0, 0, 1
{
  CONTROL "OK", IDOK, "Button", WS_TABSTOP, 160, 5, 45, 15 { 0xC0DE, 0x0001, 0x0003 }
  CONTROL "Cancel", IDCANCEL, "Button", WS_TABSTOP, 160, 23, 45, 15 { 0xC0DE, 0x0001, 0x0003 }
}
May the source be with you

Offline jj2007

  • Member
  • *
  • Posts: 441
Re: "MoveHalf" and "ResizeHalf" attributes for resizable dialogs
« Reply #4 on: December 07, 2015, 08:16:50 PM »
Interesting. So the { args } tell the resource compiler that these elements are resizable?

I saw an example by malxau here, but he uses a different syntax:
LISTBOX 4,                               5, 85,  130, 60, WS_TABSTOP
DIALOGRESIZECONTROL { 0, 100, 0, 0 }