Author Topic: Tool buttons with icons?  (Read 439 times)

fearless

  • Member
  • ***
  • Posts: 328
    • LetTheLightIn
Re: Tool buttons with icons?
« Reply #15 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.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

HSE

  • Member
  • ****
  • Posts: 711
  • <AMD>< 7-32>
Re: Tool buttons with icons?
« Reply #16 on: July 16, 2018, 05:52:57 AM »
Try downloading it again now, using the green button: Clone or Download
Perfect now  :t

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.

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.

zedd151

  • Member
  • ****
  • Posts: 719
Re: Tool buttons with icons?
« Reply #17 on: July 16, 2018, 08:11:51 AM »
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


CopyToAsm plugin: https://github.com/mrfearless/CopyToAsm-Plugin-x86

Icons used in the menus are from https://github.com/Templarian/WindowsIcons

 
@fearless:
 
that's some really nice work!   :t
Windows XP is back in full swing!

2B||!2B

  • Regular Member
  • *
  • Posts: 15
Re: Tool buttons with icons?
« Reply #18 on: July 16, 2018, 12:12:36 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.
« Last Edit: July 16, 2018, 03:47:02 PM by 2B||!2B »

fearless

  • Member
  • ***
  • Posts: 328
    • LetTheLightIn
Re: Tool buttons with icons?
« Reply #19 on: July 16, 2018, 09:35:28 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.

BTW, 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.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

HSE

  • Member
  • ****
  • Posts: 711
  • <AMD>< 7-32>
Re: Tool buttons with icons?
« Reply #20 on: July 17, 2018, 02:37:53 AM »
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

fearless

  • Member
  • ***
  • Posts: 328
    • LetTheLightIn
Re: Tool buttons with icons?
« Reply #21 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:
Code: [Select]
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)
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

HSE

  • Member
  • ****
  • Posts: 711
  • <AMD>< 7-32>
Re: Tool buttons with icons?
« Reply #22 on: July 17, 2018, 10:04:13 AM »
Well... not so well  :biggrin: :biggrin:

But bar buttons work well!

2B||!2B

  • Regular Member
  • *
  • Posts: 15
Re: Tool buttons with icons?
« Reply #23 on: July 17, 2018, 11:59:59 AM »
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.

BTW, 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.


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:
Code: [Select]
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.

Code: [Select]
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 :)

fearless

  • Member
  • ***
  • Posts: 328
    • LetTheLightIn
Re: Tool buttons with icons?
« Reply #24 on: July 17, 2018, 01:01:42 PM »
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.

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.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

2B||!2B

  • Regular Member
  • *
  • Posts: 15
Re: Tool buttons with icons?
« Reply #25 on: July 17, 2018, 03:43:24 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.

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.

fearless

  • Member
  • ***
  • Posts: 328
    • LetTheLightIn
Re: Tool buttons with icons?
« Reply #26 on: July 18, 2018, 12:17:39 AM »
I made a donation on the website given.

Thank you for that, very much appreciated.

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.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

2B||!2B

  • Regular Member
  • *
  • Posts: 15
Re: Tool buttons with icons?
« Reply #27 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:

fearless

  • Member
  • ***
  • Posts: 328
    • LetTheLightIn
Re: Tool buttons with icons?
« Reply #28 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.


fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter