News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Event-driven programming

Started by jj2007, January 28, 2017, 08:51:02 PM

Previous topic - Next topic

hutch--

This one will not run, it pops a message box saying it could not open MbSnippets.asc for Recall FileRead$.

jj2007

Oops, I forgot that this file is present only in MasmBasic installations :bgrin:

Try attached version 4 then. You can drag a plain text or RTF file over the exe to see its content in the edit control. The included source SkelGuiGroup.asc will do, for example. If you max the window, it even becomes a source viewer, but beware, clicking on some other control (case, full word, date, time) will use the edit control.

Note that, as a demo, the trackbar resets the progressbar. The trackbar control has a very odd way to communicate its status, it sends a WM_HSCROLL message:

Event Message
  .if uMsg_==WM_HSCROLL                 ; horizontal trackbar sends this message
        mov eax, lParam_
        .if eax==hTrack
                mov ticks, rv(GetTickCount)             ; try to sync with progressbar ;-)
                shl rv(SendMessage, lParam_, TBM_GETPOS, 0, 0), 9
                sub ticks, eax
        .endif
  .elseif uMsg==WM_CLOSE ...

LiaoMi

Quote from: jj2007 on December 21, 2017, 11:16:43 AM

Quote from: LiaoMi on December 21, 2017, 10:59:51 AMif you type a string with a space, then the selection of the full line doesnt work, only a part before the space is selected.

I tried that now, but if I click left of the string, the whole line gets selected. No such problem here, or do you mean something else?


Hi,

thats what I meant, correct, this is strange, I tested on windows 10 latest version, selection after space doesnt work, the fourth version ends with an exception.

EXCEPTION_DEBUG_INFO:
           dwFirstChance: 1
           ExceptionCode: C0000005 (EXCEPTION_ACCESS_VIOLATION)
          ExceptionFlags: 00000000
        ExceptionAddress: 004057EF skelguigroup.004057EF
        NumberParameters: 2
ExceptionInformation[00]: 00000000 Read
ExceptionInformation[01]: 00000000 Inaccessible Address
First chance exception on 004057EF (C0000005, EXCEPTION_ACCESS_VIOLATION)!

hutch--

Nope, version 4 does not run at all. 51712 bytes, if I double click on it, the cursor changes for a moment but it exits without displaying the window.

jj2007

Thanks, Hutch & LiaoMi. Does it also crash when you drag a file over the exe? It seems that my check for Exist(commandline) has a problem. Should be fixed with attached version 5:

Version 4 (early macro expansion):If_ Exist(CL$()) Then SetWin$ hBigEdit=FileRead$(Exist$)

Version 5 (macro expansion delayed):If_ Exist(CL$()) Then <SetWin$ hBigEdit=FileRead$(Exist$)>

[rant]it won't crash with Win7-64, and only Win7-64, because Micros**t grabs exceptions when they happen inside WndProc[/rant]

This is how it should look like, with the source in the background:

hutch--

Yep, everything on this one worked fine. Looks OK on my Win10 64 pro.

jj2007

Great, thanks :t

I know this programming style is a bit like the Antichrist for the assembler purist (and I already convinced José to dedicate himself to VB .NOT); it is a demo how powerful a macro assembler can be. Compare that for example to the desperate attempts of QT to provide a UI system that is compatible between Windows and Linux; my code produces exes around 50k, their code for a hello world UI app starts at 8MB or so.

And the code above is not just a hello world, it's a full-fledged Windows application with 17 controls that loads a RTF file from the commandline and pins a string array into the listbox etc ... the 40k overhead is there, of course, so it won't qualify for the "smallest exe ever" contest. But it works, I use it actually quite a lot for my private stuff :icon_cool:

P.S.: Just learned something when testing in my XP VM: If the manifest includes a reference to GdiPlus 1.1, the OS complains about a bad configuration. The attached XP version has a barebones manifest and loads controls version 6.00. They look nice, actually.

LiaoMi

 ::) Find - Replace still dont mark all text, when I do double-click. All other components work fine  :t

aw27

Quote from: jj2007 on December 22, 2017, 08:28:25 PM
I know this programming style is a bit like the Antichrist for the assembler purist (and I already convinced José to dedicate himself to VB .NOT);
As much as I have convinced you to produce a compiler for your High Level Language and not be dependent on assemblers.  :icon_rolleyes:

jj2007

Quote from: LiaoMi on December 22, 2017, 08:43:50 PM
::) Find - Replace still dont mark all text, when I do double-click. All other components work fine  :t

The RichEdit control behaves like that, see screenshot below.
If you place the cursor near the left border, the cursor looks to the right, and a double-click selects the full line
If you place the cursor on top of a single word, the cursor looks to the left, and a double-click selects the word.

LiaoMi

Quote from: jj2007 on December 22, 2017, 09:07:08 PM
Quote from: LiaoMi on December 22, 2017, 08:43:50 PM
::) Find - Replace still dont mark all text, when I do double-click. All other components work fine  :t

The RichEdit control behaves like that, see screenshot below.
If you place the cursor near the left border, the cursor looks to the right, and a double-click selects the full line
If you place the cursor on top of a single word, the cursor looks to the left, and a double-click selects the word.

Here everything is fine, but in the text edit component (Find text edit - Replace text edit), it does not work, just right-click and select all helps.

HSE

Quote from: aw27 on December 22, 2017, 08:58:37 PM
As much as I have convinced you to produce a compiler for your High Level Language and not be dependent on assemblers.  :icon_rolleyes:
:biggrin:

Quote from: jj2007 on December 22, 2017, 08:28:25 PM
I know this programming style is a bit like the Antichrist for the assembler purist
:biggrin:  You can add here that some people like MasmBasic but are incapable to fight with RichMasm   :(  (of course, to use MasmBasic independently require a help file that you never will write).

 

Equations in Assembly: SmplMath

jj2007

Quote from: HSE on December 23, 2017, 12:43:54 AM:biggrin:  You can add here that some people like MasmBasic but are incapable to fight with RichMasm

Open the *.asc source in WordPad or MS Word, select all, copy, paste in qEditor, and off you go ;-)

LordAdef

What's the problem with Richmasm? It's a neat ide.

jj2007

That's a nice comment, Alex, is it Christmas? :biggrin:

New version of the controls demo is here and looks like this: