The MASM Forum

General => The Campus => Topic started by: 2B||!2B on July 13, 2018, 05:35:00 PM

Title: Tool buttons with icons?
Post by: 2B||!2B on July 13, 2018, 05:35:00 PM
Hello there,

I wonder if anyone has an idea about developing such GUI like the one on TeamSpeak options?

(https://i.imgur.com/dgQF8vk.png)
Title: Re: Tool buttons with icons?
Post by: hutch-- on July 13, 2018, 05:53:42 PM
Looks like a normal vertical toolbar with its own button artwork.
Title: Re: Tool buttons with icons?
Post by: habran on July 13, 2018, 06:44:49 PM
Hi 2B||!2B,
You can check MDIRichEditMasm here (http://masm32.com/board/index.php?topic=6534.msg70095#msg70095)
It is written in 32bit asm, long time ago, it contains source how to make similar toolbar
Title: Re: Tool buttons with icons?
Post by: zedd151 on July 13, 2018, 07:41:21 PM
Something like this?...

http://masm32.com/board/index.php?topic=953.msg8570#msg8570
Title: Re: Tool buttons with icons?
Post by: fearless on July 13, 2018, 11:54:56 PM
Might even be a listview or treeview with icons and text (and no root lines or children or +/- buttons for the treeview)
Title: Re: Tool buttons with icons?
Post by: 2B||!2B on July 14, 2018, 01:21:27 PM
Quote from: hutch-- on July 13, 2018, 05:53:42 PM
Looks like a normal vertical toolbar with its own button artwork.

Nice hutch, i think you are right. TeamSpeak uses QT library and that GUI i showed is the QToolButton Class.
https://forum.qt.io/topic/59049/left-align-qtoolbuttons-in-a-vertical-qtoolbar

Quote from: habran on July 13, 2018, 06:44:49 PM
Hi 2B||!2B,
You can check MDIRichEditMasm here (http://masm32.com/board/index.php?topic=6534.msg70095#msg70095)
It is written in 32bit asm, long time ago, it contains source how to make similar toolbar

Hi habran,

Thanks for the link, i have checked that source but shows buttons with icons only.

Quote from: zedd151 on July 13, 2018, 07:41:21 PM
Something like this?...

http://masm32.com/board/index.php?topic=953.msg8570#msg8570

Very good source, however, it does not have the text next to the button. Moreover, it does not have the properties to stay "clicked" after you press the button.

Quote from: fearless on July 13, 2018, 11:54:56 PM
Might even be a listview or treeview with icons and text (and no root lines or children or +/- buttons for the treeview)

I think they are special buttons, because when you click an option it stays clicked.
Also, any option you hover on with your mouse it will highlight with a rectangle over that option.
Title: Re: Tool buttons with icons?
Post by: hutch-- on July 14, 2018, 01:55:33 PM
> Very good source, however, it does not have the text next to the button. Moreover, it does not have the properties to stay "clicked" after you press the button.

Two things, the capacity to stay clicked is just a toolbar style setting, to get text alongside an image, you do the artwork yourself as a button image does not have to be square. You would make a toolbar strip with your chosen artwork then set the bits as a vertical toolbar.
Title: Re: Tool buttons with icons?
Post by: zedd151 on July 14, 2018, 05:35:40 PM
How about this one?

Autohide Toolbar. It was a project I basically abandoned some time ago. You can reuse the code as you wish. You can set different images (including text) for each button that you need.

As is, it works as an 'Autohide Vertical Toolbar', just need to change a few thing to your exact specifications.

These are the important parts to create the toolbar as I have done in that example:


        ; The sizes aren't important here, as we will resize it in WM_SIZE
        ; in the WM_SIZE message handler
        ; create left "gripper"
        invoke CreateWindowEx,WS_EX_STATICEDGE or 201h, ADDR statClass, 0,
        WS_CHILD or WS_VISIBLE or SS_NOTIFY,1,1,LGripW,1,hWin,501,hInstance,0     
        mov hLeftGrip, eax
        ; create right "gripper"
        invoke CreateWindowEx,WS_EX_STATICEDGE or 201h, ADDR statClass, 0,
        WS_CHILD or WS_VISIBLE or SS_NOTIFY, 1,1,RGripW,1,hWin,502,hInstance,0
        mov hRightGrip, eax
        ; create right toolbar
        invoke CreateWindowEx,WS_EX_CLIENTEDGE, ADDR statClass, 0,
        WS_CHILD or WS_VISIBLE or SS_LEFT or SS_NOTIFY,1,1,1,1,hWin,503,hInstance,0
        mov hRightBar, eax
        ; set the window handler for the right toolbar
        invoke SetWindowLong, hRightBar, GWL_WNDPROC, TBRProc
       
        ; create left toolbar
       
        invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR statClass, 0,
        WS_CHILD or WS_VISIBLE or SS_LEFT or SS_NOTIFY,1,1,1,1,hWin,504,hInstance,0
        mov hLeftBar, eax
       
        ; set the window handler for the left toolbar
        invoke SetWindowLong, hLeftBar, GWL_WNDPROC, TBLProc
        ; insert "BitMap Buttons" on toolbars
        ; params:
        ; <hParent>, Left, Top, <bmp 'up'>, <bmp 'down'>, Button ID
        ; :: use the buttons' ID when processing messages
        ;    from the button, in the parents' hWnd.
        ;for the left toolbar
        invoke BmpButton, hLeftBar, 2, 2,  203, 204, 801
        invoke BmpButton, hLeftBar, 2, 29, 203, 204, 802
        invoke BmpButton, hLeftBar, 2, 56, 203, 204, 803
        ; for the right toolbar
        invoke BmpButton, hRightBar, 2, 2,  203, 204, 804
        invoke BmpButton, hRightBar, 2, 29, 203, 204, 805
        invoke BmpButton, hRightBar, 2, 56, 203, 204, 806
        ; invoke ShowWindow,SW_SHOW, for both gripper controls
        ; since we want these visible at startup
       
        invoke ShowWindow, hLeftGrip, SW_SHOW
        invoke ShowWindow, hRightGrip, SW_SHOW
        ; ShowWindow with SW_HIDE for the toolbars
        ; we want 'em outta the way 'til needed
        invoke ShowWindow, hLeftBar, SW_HIDE
        invoke ShowWindow, hRightBar, SW_HIDE

Title: Re: Tool buttons with icons?
Post by: fearless on July 14, 2018, 09:11:02 PM
(https://s20.postimg.cc/9bscn1fyx/TSOptions_screenshot.png) (https://postimg.cc/image/9bscn1fyx/)
Done a mockup of the Teamspeak Options. Few differences in my version:
- No gradient backgrounds (Teamspeak has these for selected, unselected, mouse over, active window selection, inactive window selection (grey color))
- Selection border is square (Teamspeak uses a slightly rounded border)
- keypress arrow up/down to move between the items doesnt work, only mouse selection. (Teamspeak keypress arrow up/down does move between items)

Title: Re: Tool buttons with icons?
Post by: 2B||!2B on July 15, 2018, 11:59:38 AM
Quote from: hutch-- on July 14, 2018, 01:55:33 PM
> Very good source, however, it does not have the text next to the button. Moreover, it does not have the properties to stay "clicked" after you press the button.

Two things, the capacity to stay clicked is just a toolbar style setting, to get text alongside an image, you do the artwork yourself as a button image does not have to be square. You would make a toolbar strip with your chosen artwork then set the bits as a vertical toolbar.

Thanks hutch.
You are right, i found some articles about some Owner-Drawn controls in C++ that can be modified more than a default drawn controls.
Some of which can be done by just enabling the visual-style.
Just for the record, this is a good start if anyone is looking for it
https://docs.microsoft.com/en-us/windows/desktop/Controls/using-toolbar-controls


Quote from: zedd151 on July 14, 2018, 05:35:40 PM
How about this one?

Autohide toolbar  (http://masm32.com/board/index.php?topic=4554.msg48796#msg48796)It was a project I basically abandoned some time ago. You can reuse the code as you wish. You can set different images (including text) for each button that you need.

As is, it works as an 'Autohide Vertical Toolbar', just need to change a few thing to your exact specifications.

These are the important parts to create the toolbar as I have done in that example:


        ; The sizes aren't important here, as we will resize it in WM_SIZE
        ; in the WM_SIZE message handler
        ; create left "gripper"
        invoke CreateWindowEx,WS_EX_STATICEDGE or 201h, ADDR statClass, 0,
        WS_CHILD or WS_VISIBLE or SS_NOTIFY,1,1,LGripW,1,hWin,501,hInstance,0     
        mov hLeftGrip, eax
        ; create right "gripper"
        invoke CreateWindowEx,WS_EX_STATICEDGE or 201h, ADDR statClass, 0,
        WS_CHILD or WS_VISIBLE or SS_NOTIFY, 1,1,RGripW,1,hWin,502,hInstance,0
        mov hRightGrip, eax
        ; create right toolbar
        invoke CreateWindowEx,WS_EX_CLIENTEDGE, ADDR statClass, 0,
        WS_CHILD or WS_VISIBLE or SS_LEFT or SS_NOTIFY,1,1,1,1,hWin,503,hInstance,0
        mov hRightBar, eax
        ; set the window handler for the right toolbar
        invoke SetWindowLong, hRightBar, GWL_WNDPROC, TBRProc
       
        ; create left toolbar
       
        invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR statClass, 0,
        WS_CHILD or WS_VISIBLE or SS_LEFT or SS_NOTIFY,1,1,1,1,hWin,504,hInstance,0
        mov hLeftBar, eax
       
        ; set the window handler for the left toolbar
        invoke SetWindowLong, hLeftBar, GWL_WNDPROC, TBLProc
        ; insert "BitMap Buttons" on toolbars
        ; params:
        ; <hParent>, Left, Top, <bmp 'up'>, <bmp 'down'>, Button ID
        ; :: use the buttons' ID when processing messages
        ;    from the button, in the parents' hWnd.
        ;for the left toolbar
        invoke BmpButton, hLeftBar, 2, 2,  203, 204, 801
        invoke BmpButton, hLeftBar, 2, 29, 203, 204, 802
        invoke BmpButton, hLeftBar, 2, 56, 203, 204, 803
        ; for the right toolbar
        invoke BmpButton, hRightBar, 2, 2,  203, 204, 804
        invoke BmpButton, hRightBar, 2, 29, 203, 204, 805
        invoke BmpButton, hRightBar, 2, 56, 203, 204, 806
        ; invoke ShowWindow,SW_SHOW, for both gripper controls
        ; since we want these visible at startup
       
        invoke ShowWindow, hLeftGrip, SW_SHOW
        invoke ShowWindow, hRightGrip, SW_SHOW
        ; ShowWindow with SW_HIDE for the toolbars
        ; we want 'em outta the way 'til needed
        invoke ShowWindow, hLeftBar, SW_HIDE
        invoke ShowWindow, hRightBar, SW_HIDE



Hi zedd,

Thank you for your participating.
Very nice style of auto-hide toolbar.

Quote from: fearless on July 14, 2018, 09:11:02 PM
(https://s20.postimg.cc/9bscn1fyx/TSOptions_screenshot.png) (https://postimg.cc/image/9bscn1fyx/)
Done a mockup of the Teamspeak Options. Few differences in my version:
- No gradient backgrounds (Teamspeak has these for selected, unselected, mouse over, active window selection, inactive window selection (grey color))
- Selection border is square (Teamspeak uses a slightly rounded border)
- keypress arrow up/down to move between the items doesnt work, only mouse selection. (Teamspeak keypress arrow up/down does move between items)

Absolutely amazing work man. Very nice GUI there. :greenclp:.
The differences are not that much important.
However, i couldn't compile it due to some errors in Windows.inc.

C:\masm32\include\windows.inc(16529) : error A2037: statement not allowed inside structure definition
szText(2): Macro Called From
  C:\masm32\include\windows.inc(16529): Include File
C:\masm32\include\windows.inc(16529) : error A2008: syntax error : db
szText(3): Macro Called From
  C:\masm32\include\windows.inc(16529): Include File
C:\masm32\include\windows.inc(16529) : error A2034: must be in segment block
szText(4): Macro Called From
  C:\masm32\include\windows.inc(16529): Include File
C:\masm32\include\windows.inc(16541) : error A2037: statement not allowed inside structure definition
szText(2): Macro Called From
  C:\masm32\include\windows.inc(16541): Include File
C:\masm32\include\windows.inc(16541) : error A2008: syntax error : db
szText(3): Macro Called From
  C:\masm32\include\windows.inc(16541): Include File
C:\masm32\include\windows.inc(16541) : error A2034: must be in segment block

EDIT: I fixed it by renaming the szText member of NMTTDISPINFOA structure to _szText. Same for NMTTDISPINFOW
it's weird but it worked.

BTW, is that you?
https://github.com/mrfearless/ModernUI

I must say that this is the best GUI coded in ASM i have ever seen.  :t
Title: Re: Tool buttons with icons?
Post by: fearless on July 15, 2018, 06:02:06 PM
Quote from: 2B||!2B on July 15, 2018, 11:59:38 AM
BTW, is that you?
https://github.com/mrfearless/ModernUI (https://github.com/mrfearless/ModernUI)

I must say that this is the best GUI coded in ASM i have ever seen.  :t
Thanks :D Yes, that is me, i have a link to my github stuff at the bottom of my signature. Its available for anyone to contribute to or use. Plus there is an x64 version for uasm64 - https://github.com/mrfearless/ModernUI64 (not always as in sync with the x86 version). Still occasionally adding to it, or thinking up ideas/testing new controls that haven't been added yet. Some stuff hasn't been optimized and/or features i would like haven't been added in. Plus some stuff might have a few bugs im sure.
Here is a couple of screenshots of using those buttons and other controls with child dialogs to achieve an options type panel i used for a few x64dbg plugins:
Codeshot plugin: https://github.com/mrfearless/CodeShot-Plugin-x86
(https://s20.postimg.cc/6a91o8a8p/cs_filenameoptions.png) (https://postimg.cc/image/6a91o8a8p/)

CopyToAsm plugin: https://github.com/mrfearless/CopyToAsm-Plugin-x86
(https://s20.postimg.cc/gasmh8gxl/cta_comment_options.png) (https://postimg.cc/image/gasmh8gxl/)
Icons used in the menus are from https://github.com/Templarian/WindowsIcons
Title: Re: Tool buttons with icons?
Post by: 2B||!2B on July 15, 2018, 07:16:15 PM
Quote from: fearless on July 15, 2018, 06:02:06 PM
Quote from: 2B||!2B on July 15, 2018, 11:59:38 AM
BTW, is that you?
https://github.com/mrfearless/ModernUI (https://github.com/mrfearless/ModernUI)

I must say that this is the best GUI coded in ASM i have ever seen.  :t
Thanks :D Yes, that is me, i have a link to my github stuff at the bottom of my signature. Its available for anyone to contribute to or use. Plus there is an x64 version for uasm64 - https://github.com/mrfearless/ModernUI64 (not always as in sync with the x86 version). Still occasionally adding to it, or thinking up ideas/testing new controls that haven't been added yet. Some stuff hasn't been optimized and/or features i would like haven't been added in. Plus some stuff might have a few bugs im sure.
Here is a couple of screenshots of using those buttons and other controls with child dialogs to achieve an options type panel i used for a few x64dbg plugins:
Codeshot plugin: https://github.com/mrfearless/CodeShot-Plugin-x86
(https://s20.postimg.cc/6a91o8a8p/cs_filenameoptions.png) (https://postimg.cc/image/6a91o8a8p/)

CopyToAsm plugin: https://github.com/mrfearless/CopyToAsm-Plugin-x86
(https://s20.postimg.cc/gasmh8gxl/cta_comment_options.png) (https://postimg.cc/image/gasmh8gxl/)
Icons used in the menus are from https://github.com/Templarian/WindowsIcons

Fabulous work man, the GUI there looks professional.

BTW, i have downloaded your Modern GUI (32-bit version) and i have encountered some troubles:

1- The dialogs (MUICaptionBar#) examples are not re sizable. Was this deliberately made?

2- I have added everything from "RadASM ModernUI Api files.zip" to the corresponding RadASM files. However, i am still unable to compile MUIMenu1 example.
Technically speaking, there a is missing parameter in the call to MUIApplyToDialog API. On the example it is called as so
Invoke MUIApplyToDialog, hWin, TRUE
however, its prototype has 3 parameters but that was easy to fix.
The other issue i faced is that the MUI_MENUITEM_DARKTHEME is not declared anywhere "Symbol not defined : MUI_MENUITEM_DARKTHEME" i couldn't find the declaration anywhere in the files provided.
I would really appreciate a hand over here.
Thanks.
Title: Re: Tool buttons with icons?
Post by: fearless on July 15, 2018, 08:54:17 PM
I updated the radasm definition for that function MUIApplyToDialog, basically i added a third parameter to turn on/off clipping (true/false)
I renamed MUI_MENUITEM_DARKTHEME to MUI_MENUITEM_DARK_THEME for some reason, but didnt update the example to reflect this. They where stored in the ModernUI_Button.inc files - testing out easier way of setting all properties at once instead of individual calls to property settings.

Not sure which is best/easiest - from my own experience its awkward to set the values in the properties in the larger structures - easy to miss a setting, not provide enough commas etc, not as readable/easy to write/change setting in IDE - but once set, it is handier to call and use than individual calls to set properties. Each has its pros and cons i suppose.

I updated the MUIMenu1 example in the releases folder.
Yes the dialogs using the captionbar arent resizable currently in the normal traditional sense, but the min/max/restore works for that sizing. It was a feature i would like to add at some point, but i hadnt got round to coding that or deciding how best to do that. Some earlier prototypes i did do was to create a sizegrip control that handled that for the window, like the normal grip thing with dots you see on statusbars to indicate the window can be resized. It changed the cursor to a resize arrow when mouseover and did work but it was slightly odd - cant explain exactly, but i wasnt happy with that and so left that until i could figure out a better, more visually accurate way of handling that, probably to later also include sizing of all borders (detect mouse position with 2/3px of border and change cursor and subclass the parent to handle the resize, something like that)
Title: Re: Tool buttons with icons?
Post by: fearless on July 15, 2018, 09:02:03 PM
Here is an example of the resize grip control (older pre modernui control) but should still work fine. To give an idea of what i had initially done as a starting point.

Rough example of usage based on a test program i had with it
    ; System Resize Grip   
    Invoke GetClientRect, hSF_StatusBar, Addr rect   
    mov eax, rect.right    sub eax, 22
    ;mov ebx, rect.bottom
    mov ebx, 6
    ;sub ebx, 22
    Invoke SmartResizeGripCreate, hSF_StatusBar, eax, ebx, 20, 18, IDC_RESIZEGRIP
    mov hSysResizeGrip, eax
    Invoke SendMessage, hSysResizeGrip, SRM_SETTEXTCOLOR, SRRGBCOLOR(111,121,149), 0
    Invoke SendMessage, hSysResizeGrip, SRM_SETBACKCOLOR, SRRGBCOLOR(38,50,56), 0
    Invoke SendMessage, hSysResizeGrip, SRM_SETRESIZEWIN, hWin, 0
Title: Re: Tool buttons with icons?
Post by: HSE on July 16, 2018, 03:38:45 AM
Hi Fearless!

Quote from: fearless on July 15, 2018, 06:02:06 PM
Codeshot plugin: https://github.com/mrfearless/CodeShot-Plugin-x86

How you make that RadAsm 2.2.2.3 can understand textfiles with 0A end of line? (CodeShot.asm as example)

Can ModernUI work with normal windows (WS_EX_OVERLAPPEDWINDOW) instead of dialogs? (obviously I failed to achive that  :biggrin:)

Tnaks.
Title: Re: Tool buttons with icons?
Post by: fearless on July 16, 2018, 04:52:11 AM
I think its due to the way github handles CR/LF normalization, that strips out the line endings in some cases. I have added a .gitattribute to most of my repositories to adjust for that. If you clone/download the entire repo the files arent stripped of the CR now. If you read a file in the browser (open a file raw from the repository) and download it, github still strips the CR from it.
Try downloading it again now, using the green button: Clone or Download
Dont know of hand if there is anything that would prevent it from working with normal windows. As long as your creating the control somewhere on the window i guess it shouldnt be any different. Let me know if its not working and/or show some example code/project so i can check that for you if that turns out not to work.
Title: Re: Tool buttons with icons?
Post by: HSE on July 16, 2018, 05:52:57 AM
Quote from: fearless on July 16, 2018, 04:52:11 AM
Try downloading it again now, using the green button: Clone or Download
Perfect now  :t

Quote from: fearless on July 16, 2018, 04:52:11 AM
Dont know of hand if there is anything that would prevent it from working with normal windows. As long as your creating the control somewhere on the window i guess it shouldnt be any different.
Then, for sure I was making something wrong. There is not examples with no-dialog windows.

Quote from: fearless on July 16, 2018, 04:52:11 AM
Let me know if its not working and/or show some example code/project so i can check that for you if that turns out not to work.
Perhaps I could find a backup, because I remove everything I was triying. If not, I will try a new project.

Thanks.
Title: Re: Tool buttons with icons?
Post by: zedd151 on July 16, 2018, 08:11:51 AM
Quote from: fearless on July 15, 2018, 06:02:06 PMThanks :D Yes, that is me, i have a link to my github stuff at the bottom of my signature. Its available for anyone to contribute to or use. Plus there is an x64 version for uasm64 - https://github.com/mrfearless/ModernUI64 (https://github.com/mrfearless/ModernUI64) (not always as in sync with the x86 version). Still occasionally adding to it, or thinking up ideas/testing new controls that haven't been added yet. Some stuff hasn't been optimized and/or features i would like haven't been added in. Plus some stuff might have a few bugs im sure.
Here is a couple of screenshots of using those buttons and other controls with child dialogs to achieve an options type panel i used for a few x64dbg plugins:
Codeshot plugin: https://github.com/mrfearless/CodeShot-Plugin-x86 (https://github.com/mrfearless/CodeShot-Plugin-x86)
(https://s20.postimg.cc/6a91o8a8p/cs_filenameoptions.png) (https://postimg.cc/image/6a91o8a8p/)

CopyToAsm plugin: https://github.com/mrfearless/CopyToAsm-Plugin-x86 (https://github.com/mrfearless/CopyToAsm-Plugin-x86)
(https://s20.postimg.cc/gasmh8gxl/cta_comment_options.png) (https://postimg.cc/image/gasmh8gxl/)
Icons used in the menus are from https://github.com/Templarian/WindowsIcons (https://github.com/Templarian/WindowsIcons)


@fearless:

that's some really nice work!   :t
Title: Re: Tool buttons with icons?
Post by: 2B||!2B on July 16, 2018, 12:12:36 PM
Quote from: fearless on July 15, 2018, 08:54:17 PM
I updated the radasm definition for that function MUIApplyToDialog, basically i added a third parameter to turn on/off clipping (true/false)
I renamed MUI_MENUITEM_DARKTHEME to MUI_MENUITEM_DARK_THEME for some reason, but didnt update the example to reflect this. They where stored in the ModernUI_Button.inc files - testing out easier way of setting all properties at once instead of individual calls to property settings.

Not sure which is best/easiest - from my own experience its awkward to set the values in the properties in the larger structures - easy to miss a setting, not provide enough commas etc, not as readable/easy to write/change setting in IDE - but once set, it is handier to call and use than individual calls to set properties. Each has its pros and cons i suppose.

I updated the MUIMenu1 example in the releases folder.
Yes the dialogs using the captionbar arent resizable currently in the normal traditional sense, but the min/max/restore works for that sizing. It was a feature i would like to add at some point, but i hadnt got round to coding that or deciding how best to do that. Some earlier prototypes i did do was to create a sizegrip control that handled that for the window, like the normal grip thing with dots you see on statusbars to indicate the window can be resized. It changed the cursor to a resize arrow when mouseover and did work but it was slightly odd - cant explain exactly, but i wasnt happy with that and so left that until i could figure out a better, more visually accurate way of handling that, probably to later also include sizing of all borders (detect mouse position with 2/3px of border and change cursor and subclass the parent to handle the resize, something like that)

Hi Fearless,

Thank you for your awesome work.

Yes i realized that after i made the post that the structure has been renamed.
I have successfully compiled the menu example.
As for the resizing, there is also a problem when you drag the window to an edge of the screen, it doesn't show the ability to resize (the glassy window on Vista+)
but that is not really important.
I liked the design of the captions, it looks really like a Windows 10 GUI.
I am happy with what i got for the buttons,the menus and some other useful stuff.

Just to mention that the design-time MUI button when you add it over a dialog, the application then fails to execute. Particularly, the CreateDialogParam api fails.
The same goes for special RAD controls like File browser etc.

BTW, are you going to update the project in future? or this is the last update?

Thanks man.
Title: Re: Tool buttons with icons?
Post by: fearless on July 16, 2018, 09:35:28 PM
Quote from: 2B||!2B on July 16, 2018, 12:12:36 PM
Just to mention that the design-time MUI button when you add it over a dialog, the application then fails to execute. Particularly, the CreateDialogParam api fails.
The same goes for special RAD controls like File browser etc.
Im guessing the control wasnt registered before the dialog was created. Normally i put those calls at very start of program before winmain is called. So if your using the ModernUI_Button on a dialog via the radasm design time control, then a call to MUIButtonRegister would be required (Invoke MUIButtonRegister) beforehand.

Quote from: 2B||!2B on July 16, 2018, 12:12:36 PMBTW, are you going to update the project in future? or this is the last update?
Its an ongoing process, with periods of inactivity. I have some plans and ideas for things id like to fix, refactor, or add to the whole project and/or specific controls. Some stuff im waiting for inspiration before I continue :D and others are contingent on completing some controls that i haven't got round to, or i'm not sure how to tackle, or there may be better ways of coding than what is in the whole project currently.

As its on github anyone can contribute, and add issues, add documentation/wiki stuff, request features for controls, suggest ideas. So hopefully its not the last update.
Title: Re: Tool buttons with icons?
Post by: HSE on July 17, 2018, 02:37:53 AM
Quote from: fearless on July 16, 2018, 09:35:28 PM
Im guessing the control wasnt registered before the dialog was created. Normally i put those calls at very start of program before winmain is called.
Some like that could be my problem. :t
Title: Re: Tool buttons with icons?
Post by: fearless on July 17, 2018, 03:57:37 AM
I think MUICaptionBar1 shows how to do the captionbar control by creating it in WM_INITDIALOG. MUICaptionBar2 and MUICaptionBar3 have the call to register before winmain:
start:

    Invoke GetModuleHandle,NULL
    mov hInstance, eax
    Invoke GetCommandLine
    mov CommandLine, eax
    Invoke InitCommonControls
    mov icc.dwSize, sizeof INITCOMMONCONTROLSEX
    mov icc.dwICC, ICC_COOL_CLASSES or ICC_STANDARD_CLASSES or ICC_WIN95_CLASSES
    Invoke InitCommonControlsEx, offset icc
   
    ; To be able to use the RadASM custom control on the main dialog resource
    ; MUICaptionBar.dlg - we have to call this function to register our
    ; caption bar control. Then we enter 'ModernUI_CaptionBar' as our class
    ; in the RadASM custom control. The control is thus created automatically
    ; for us when the dialog is instantiated.
   
    Invoke MUICaptionBarRegister
   
    Invoke WinMain, hInstance, NULL, CommandLine, SW_SHOWDEFAULT
    Invoke ExitProcess, eax

Obviously if other controls are being used in similar manner (via dialog) then they would need to be registered similarly before the dialog is created (before CreateDialog etc)
Title: Re: Tool buttons with icons?
Post by: HSE on July 17, 2018, 10:04:13 AM
Well... not so well  :biggrin: :biggrin:

But bar buttons work well!
Title: Re: Tool buttons with icons?
Post by: 2B||!2B on July 17, 2018, 11:59:59 AM
Quote from: fearless on July 16, 2018, 09:35:28 PM
Quote from: 2B||!2B on July 16, 2018, 12:12:36 PM
Just to mention that the design-time MUI button when you add it over a dialog, the application then fails to execute. Particularly, the CreateDialogParam api fails.
The same goes for special RAD controls like File browser etc.
Im guessing the control wasnt registered before the dialog was created. Normally i put those calls at very start of program before winmain is called. So if your using the ModernUI_Button on a dialog via the radasm design time control, then a call to MUIButtonRegister would be required (Invoke MUIButtonRegister) beforehand.

Quote from: 2B||!2B on July 16, 2018, 12:12:36 PMBTW, are you going to update the project in future? or this is the last update?
Its an ongoing process, with periods of inactivity. I have some plans and ideas for things id like to fix, refactor, or add to the whole project and/or specific controls. Some stuff im waiting for inspiration before I continue :D and others are contingent on completing some controls that i haven't got round to, or i'm not sure how to tackle, or there may be better ways of coding than what is in the whole project currently.

As its on github anyone can contribute, and add issues, add documentation/wiki stuff, request features for controls, suggest ideas. So hopefully its not the last update.

Hi fearless,

Cool man!

Maybe you should open the donation so i can support the project since i am not that pro when it comes to GUI stuff.


Quote from: fearless on July 17, 2018, 03:57:37 AM
I think MUICaptionBar1 shows how to do the captionbar control by creating it in WM_INITDIALOG. MUICaptionBar2 and MUICaptionBar3 have the call to register before winmain:
start:

    Invoke GetModuleHandle,NULL
    mov hInstance, eax
    Invoke GetCommandLine
    mov CommandLine, eax
    Invoke InitCommonControls
    mov icc.dwSize, sizeof INITCOMMONCONTROLSEX
    mov icc.dwICC, ICC_COOL_CLASSES or ICC_STANDARD_CLASSES or ICC_WIN95_CLASSES
    Invoke InitCommonControlsEx, offset icc
   
    ; To be able to use the RadASM custom control on the main dialog resource
    ; MUICaptionBar.dlg - we have to call this function to register our
    ; caption bar control. Then we enter 'ModernUI_CaptionBar' as our class
    ; in the RadASM custom control. The control is thus created automatically
    ; for us when the dialog is instantiated.
   
    Invoke MUICaptionBarRegister
   
    Invoke WinMain, hInstance, NULL, CommandLine, SW_SHOWDEFAULT
    Invoke ExitProcess, eax

Obviously if other controls are being used in similar manner (via dialog) then they would need to be registered similarly before the dialog is created (before CreateDialog etc)

I have done the same.
However, i am still unable to get the app showing.

invoke MUIButtonRegister
Invoke WinMain, hInstance, NULL, CommandLine, SW_SHOWDEFAULT


The caption bar control works on design time but not the button.
The dialog just stops showing as soon as you add a button over the dialog.


Got it working thanks man :)
Title: Re: Tool buttons with icons?
Post by: fearless on July 17, 2018, 01:01:42 PM
Quote from: 2B||!2B on July 17, 2018, 11:59:59 AM
Maybe you should open the donation so i can support the project since i am not that pro when it comes to GUI stuff.
Thanks for your suggestion, but more importantly, thank you for your support. I've created a buymeacoffee link and added it to the readme's of the ModernUI projects: https://www.buymeacoffee.com/mrfearless
I really dont expect anyone to donate, I'm just happy that others might find my stuff useful in some small way.

Quote from: 2B||!2B on July 17, 2018, 11:59:59 AM
Got it working thanks man :)
Nice, could you let us know what you did, just in case someone else runs into the same issue. Thanks.
Title: Re: Tool buttons with icons?
Post by: 2B||!2B on July 17, 2018, 03:43:24 PM
Quote from: fearless on July 17, 2018, 01:01:42 PM
Thanks for your suggestion, but more importantly, thank you for your support. I've created a buymeacoffee link and added it to the readme's of the ModernUI projects: https://www.buymeacoffee.com/mrfearless
I really dont expect anyone to donate, I'm just happy that others might find my stuff useful in some small way.

Hi man,

Thanks for your nice words. Your stuff is handy to anyone who wants to code a neat looking GUI in no time, specially considering that making such GUI in assembly language is time consuming. I made a donation on the website given.

Quote from: fearless on July 17, 2018, 01:01:42 PM
Nice, could you let us know what you did, just in case someone else runs into the same issue. Thanks.

I just had a RAD file browser control and although i had it removed from the dialog it was still not working (Dialog api fails to create the dialog), for some weird reason, i had to go manually to the make menu and compile RC again to get rid of the RAD file browser control from the resources.
Title: Re: Tool buttons with icons?
Post by: fearless on July 18, 2018, 12:17:39 AM
Quote from: 2B||!2B on July 17, 2018, 03:43:24 PM
I made a donation on the website given.

Thank you for that, very much appreciated.

Quote from: 2B||!2B on July 17, 2018, 03:43:24 PM
I just had a RAD file browser control and although i had it removed from the dialog it was still not working (Dialog api fails to create the dialog), for some weird reason, i had to go manually to the make menu and compile RC again to get rid of the RAD file browser control from the resources.
Im guessing the radasm controls need to have the appropriate .dll file in your projects folder (or somewhere in a folder on the path environment %PATH%), probably RAFile.dll for it to work, the dll's entry then calls the RAFile's install function InstallFileBrowser (which registers it), then the dialog creation will autocreate it as the class will have been registered and can be located (in the dll). But yes removing the rad file browser control and recompiling the resource will have removed that reference so the dialog manager doesnt look for it, when its created the dialog and all the child controls.
Title: Re: Tool buttons with icons?
Post by: 2B||!2B on July 18, 2018, 12:11:34 PM
No problem man, just a small appreciation  :bgrin:

About RadASM's special controls:
So it needs dlls dependencies to work properly?
Would have been better if it was static library
I guess it isn't a good idea to have dependencies in ASM so i prefer to do it manually then  :bgrin:
Title: Re: Tool buttons with icons?
Post by: fearless on July 18, 2018, 08:56:30 PM
Yes needs those those dlls if your using those RadASM special controls.
Yes, I agree, a static library option would have been handy. Although it is possible to modify then to be static libraries - but you would have to change a few bits and pieces and manually call the DllInstall function (which can be renamed - so its kind of similar to the ModernUI register functions in that way).

I did do that with the RAHex control - from the original source on sourceforge - to make it a standalone static component. Although it did mean putting together a few support functions to help setup the control beforehand as there is a lot of little bits and pieces it needs - different fonts and other things for it to load and work. I might gather that together and post that up if its useful for someone to have a static hex control - I've only used it as a hex viewer for small amounts of data, not looked at the editing and saving part - all to do with richedit control streams for reading in and writing out.


Title: Re: Tool buttons with icons?
Post by: 2B||!2B on July 20, 2018, 12:41:48 PM
Quote from: fearless on July 18, 2018, 08:56:30 PM
Yes needs those those dlls if your using those RadASM special controls.
Yes, I agree, a static library option would have been handy. Although it is possible to modify then to be static libraries - but you would have to change a few bits and pieces and manually call the DllInstall function (which can be renamed - so its kind of similar to the ModernUI register functions in that way).

I did do that with the RAHex control - from the original source on sourceforge - to make it a standalone static component. Although it did mean putting together a few support functions to help setup the control beforehand as there is a lot of little bits and pieces it needs - different fonts and other things for it to load and work. I might gather that together and post that up if its useful for someone to have a static hex control - I've only used it as a hex viewer for small amounts of data, not looked at the editing and saving part - all to do with richedit control streams for reading in and writing out.

Perfect man. How long does it take to modify one RadASM control to make it like your MUI examples (that no longer needs the dlls)?

Also, check your PM.
Title: Re: Tool buttons with icons?
Post by: fearless on July 20, 2018, 07:04:13 PM
I have the RAHexEd one as a static library here: http://masm32.com/board/index.php?topic=7287.0
Any particular control you require as a static library? Not sure if the sources/projects for all the controls are available, would have to look to see and to see if anything needs tweaking or potentially changed/stripped out, depending on the control and how its tied in with everything else.
Title: Re: Tool buttons with icons?
Post by: 2B||!2B on July 20, 2018, 08:46:58 PM
Quote from: fearless on July 20, 2018, 07:04:13 PM
I have the RAHexEd one as a static library here: http://masm32.com/board/index.php?topic=7287.0
Any particular control you require as a static library? Not sure if the sources/projects for all the controls are available, would have to look to see and to see if anything needs tweaking or potentially changed/stripped out, depending on the control and how its tied in with everything else.

Very nice work  :eusa_clap:
This one is very useful.
For a particular control, i was looking to fix the RichEdit control. It has the same problem as filebrowser control: once added, the dialog box won't be created.