The MASM Forum

Projects => MasmBasic & the RichMasm IDE => Topic started by: LordAdef on January 26, 2018, 06:32:58 PM

Title: SlimViewer, project in MasmBasic
Post by: LordAdef on January 26, 2018, 06:32:58 PM
Hi JJ,

I´m starting this thread for that side project I told you about.

well, I managed to get a Combobox, although I have no clue of what I´m doing :dazzled:

So far, this is what I get:
   include \masm32\MasmBasic\Res\MbGui.asm
Init

   Let esi=FolderOpen$()      ; no args = use Windows defaults, start with current folder
      
   ;GuiControl MyEdit, "richedit", "Go to the menu and open a file", y80+20
   
   ; ------------------- StatusBar  ------------------------
   GuiControl MySbar, "statusbar", text "MasmBasic is easy"

   ; ------------------- ComboBox ------------------------
      GuiControl MyLb, "combobox", y 60, h 100
      GuiControl MyEd, "static", text "Double-click to open a file ", h 50
      GetFiles esi *.as?
      ;SortFiles      ; latest files on top
      SetListbox Files$()      ; Fill the listbox with UTF-8 encoded file names
      ; SetCombobox Files$()      ; This gives me an error
      Event Command
      .if NotifyCode==LBN_DBLCLK
      ; this gives me an error
      ;uShEx LbSel$      ; open selected file with ShellExecuteW (u=assume UTF-8 for LbSel$)
      .endif
      GuiEnd
EndOfCode[/quote]

SetComboBox gives me this: "Symbol not defined : StringArrHeader.fSize"

Firstly, How do I set the windows´ size?
Secondly: if GetFiles *.as?   ; asc, asm, rc    has no full address, does it give me the file list from where my .exe is running? In case of a plugin, the folder of the current opened .asc?
Thirdly, it seems GuiControl still hasn´t got treeview implemented. Right?

BTW, MB is fun!
Title: Re: SlimViewer, project in MasmBasic
Post by: jj2007 on January 26, 2018, 09:27:05 PM
Quote from: LordAdef on January 26, 2018, 06:32:58 PM
SetComboBox gives me this: "Symbol not defined : StringArrHeader.fSize"
That is a bug, thanks for finding it ;); see code below for instructions.

QuoteFirstly, How do I set the windows´ size?

GuiParas equ "Hello LordAdef", x650, y20, w200, h200, cblack, b00FFFFD0h
GuiMenu equ @File, &Open, &Save, -, E&xit, @Edit, Undo, Copy, Paste
include \masm32\MasmBasic\Res\MbGui.asm
Event Menu
  deb 1, "You clicked", MenuID
Event Message
  inc msgCount
  deb 4, "msg", chg:msgCount    ; , wParam, lParam      ; see deb (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1019)
GuiEnd


QuoteSecondly: if GetFiles *.as?   ; asc, asm, rc    has no full address, does it give me the file list from where my .exe is running? In case of a plugin, the folder of the current opened .asc?
Yes. But you can construct other paths with Cat$(), see below.

QuoteThirdly, it seems GuiControl still hasn´t got treeview implemented. Right?

BTW, MB is fun!

Thanks :biggrin:

GuiControl might work with a treeview, but I never tested it. Try GuiControl MyTree, "SysTreeview32", style TVS_HASLINES
If you don't see error messages, you have a treeview control with handle hMyTree. All the rest has to be done manually, e.g. with the TVM_INSERTITEM message (https://msdn.microsoft.com/en-us/library/windows/desktop/bb773733%28v=vs.85%29.aspx).


   include \masm32\MasmBasic\Res\MbGui.asm
; Init ; not needed for the MbGui family

    Let esi=FolderOpen$()      ; no args = use Windows defaults, start with current folder
       
    ;GuiControl MyEdit, "richedit", "Go to the menu and open a file", y80+20
   
    ; ------------------- StatusBar  ------------------------
    GuiControl MySbar, "statusbar", text "MasmBasic is easy"

   ; ------------------- ComboBox ------------------------
      GuiControl MyLb, "combobox", y 60, h 100
      GuiControl MyEd, "static", text "Double-click to open a file ", h 50
      GetFiles Cat$(esi+"\*.as?")
      deb 4, "files found", eax ; use console output to verify what's happening!
      ;SortFiles      ; latest files on top
      ; SetListbox Files$()      ; Fill the listbox with UTF-8 encoded file names
      SetCombobox Files$()      ; This gives me an error -> in \masm32\MasmBasic\Res\MbGui.asm, change StringArrHeader.fSize to StringArrHeader.AnsiSize

      Event Command
      .if NotifyCode==CBN_SELCHANGE
    ; this gives me an error
    PrintLine "[", CbSel$, "]" ; use console output to verify what's happening!
    wShEx wRec$(CbSel$)      ; open selected file with ShellExecuteW (u=assume UTF-8 for LbSel$)
      .endif
      GuiEnd
Title: Re: SlimViewer, project in MasmBasic
Post by: LordAdef on February 02, 2018, 04:47:26 PM
Would you give me an example, one parent? I got a bit lost
Title: Re: SlimViewer, project in MasmBasic
Post by: jj2007 on February 02, 2018, 07:21:51 PM
Strangely enough, I have never used a TreeView before. Anyway, I got it working (project attached):

GuiParas equ "TreeView demo", x650, y20, w200, h400, cblack, b00FFFFD0h
include \masm32\MasmBasic\Res\MbGui.asm
GuiControl MyTree, "SysTreeview32", style TVS_HASLINES or TVS_SINGLEEXPAND, bcol RgbCol(255, 240, 0)
  SetGlobals tvi:TV_INSERTSTRUCT
  m2m tvi.hParent, TVI_ROOT
  mov tvi.hInsertAfter, TVI_LAST
  m2m tvi.item.imask, TVIF_TEXT
  mov tvi.item.pszText, Chr$("I am the root")
  mov tvi.hParent, rv(SendMessage, hMyTree, TVM_INSERTITEM, 0, addr tvi)

  For_ ct=1 To 29
        mov tvi.item.pszText, Str$("This is line %i", ct)
        invoke SendMessage, hMyTree, TVM_INSERTITEM, 0, addr tvi
  Next
GuiEnd


To see the nodes, double-click on "I am the root".
Title: Re: SlimViewer, project in MasmBasic
Post by: LordAdef on February 03, 2018, 02:37:47 AM
I cannot build you example. Error in line #3.
Title: Re: SlimViewer, project in MasmBasic
Post by: jj2007 on February 03, 2018, 03:26:52 AM
Comment out ; bcol... (the background colour doesn't work anyway with this control)
Title: Re: SlimViewer, project in MasmBasic
Post by: LordAdef on February 03, 2018, 01:19:29 PM
Yes, thanks!

So, code:



; --------------------------------------------------------------------------------------------------------------------------
;                                                      Window / Menu  / StatusBar
; --------------------------------------------------------------------------------------------------------------------------
GuiParas equ "SlimViewer", x650, y20, w800, h900, cblack,  b 0EEEFFFh ; Last item == Bk colour
GuiMenu equ @File, &Open, &Save, -, E&xit, @Edit, Undo, Copy, Paste
include \masm32\MasmBasic\Res\MbGui.asm ; It MUST go after GuiMenu. WHY JJ??
GuiControl MySbar, "statusbar", text "MasmBasic is easy"

    ; --------------------------------------------------------------------------------------------------------------------------
;                                                        ComboBox
; --------------------------------------------------------------------------------------------------------------------------
Let esi=FolderOpen$()

GuiControl MyEd, "static", x 5, y 55, h 24, w200, text "Select a file: " ; Label
GuiControl MyLb, "combobox", x 5, y 80, h 500, w 300 ; no args = use Win defaults, start with current folder
GetFiles Cat$ ("\*.as?")    ; (esi+"\*.as?") for full path
deb 4, "files found", eax ; use console output to verify what's happening!
SortFiles      ; latest files on top
SetCombobox Files$()     
; --------------------------------------------------------------------------------------------------------------------------
;                                                        TreeView
; --------------------------------------------------------------------------------------------------------------------------

GuiParas  equ "TreeView demo", x 70, y 0, w 55, h100, cblack,  b 0EEEEEEh   ;;<== IS THIS DOING ANYTHING ???
GuiControl MyTree, "SysTreeview32", x 5 , y 120, w 300 , h 880 ,  style  WS_BORDER or TVS_SINGLEEXPAND or TVS_LINESATROOT or TVS_HASBUTTONS or TVS_HASLINES or TVS_FULLROWSELECT

SetGlobals tvi:TV_INSERTSTRUCT

;  Root Procedure :
m2m tvi.hParent, TVI_ROOT
mov tvi.hInsertAfter, TVI_LAST
m2m tvi.item.imask, TVIF_TEXT
mov tvi.item.pszText, Chr$("Procedures")
mov tvi.hParent, rv(SendMessage, hMyTree, TVM_INSERTITEM, 0, addr tvi)

For_ ct=1 To 29
mov tvi.item.pszText, Str$("proc %i", ct)
invoke SendMessage, hMyTree, TVM_INSERTITEM, 0, addr tvi
Next

; Root Macros :
m2m tvi.hParent, TVI_ROOT
mov tvi.hInsertAfter, TVI_LAST
m2m tvi.item.imask, TVIF_TEXT
mov tvi.item.pszText, Chr$("Macros")
mov tvi.hParent, rv(SendMessage, hMyTree, TVM_INSERTITEM, 0, addr tvi)

For_ ct=1 To 29
mov tvi.item.pszText, Str$("macros %i", ct)
invoke SendMessage, hMyTree, TVM_INSERTITEM, 0, addr tvi
Next
; --------------------------------------------------------------------------------------------------------------------------
;                                                       RichEdit
; --------------------------------------------------------------------------------------------------------------------------
  GuiControl Overview, "richedit", x 310, y 120, h880, w490


; --------------------------------------------------------------------------------------------------------------------------
;                                                        Events
; --------------------------------------------------------------------------------------------------------------------------

Event Menu
deb 1, "You clicked", MenuID
Event Message
inc msgCount
deb 4, "msg", chg:msgCount    ; , wParam, lParam      ; see deb
Event Command
    .if NotifyCode==CBN_SELCHANGE
    PrintLine "[", CbSel$, "]" ; use console output to verify what's happening!
    wShEx wRec$(CbSel$)      ; open selected file with ShellExecuteW (u=assume UTF-8 for LbSel$)
    .endif
GuiEnd
EndOfCode


1. Why include \masm32\MasmBasic\Res\MbGui.asm must go after GuiMenu and What things wont work preceding the include (it took me a while to figure this was the reason the Menu wasn´t showing up).

2. This line doesn´t seem to be doing anything:  GuiParas  equ "TreeView demo", x 70, y 0, w 55, h100, cblack,  b 0EEEEEEh
    Only when I moved x y h w coord into Gui TreView, it worked


Don´t curse at me JJ, this is a crash course for MasmBasic Noobs! It will serve for others too   :greenclp: :bgrin::eusa_dance:
Title: Re: SlimViewer, project in MasmBasic
Post by: LordAdef on February 03, 2018, 04:14:50 PM
Next step is to search for proc names within the selected file.

I saw many possible instructions: FileRead$, FileOpen$, Open.  Seek,  ArraySearch and Trim looked useful.
What´s the best MB way of doing this?
Title: Re: SlimViewer, project in MasmBasic
Post by: jj2007 on February 03, 2018, 08:15:39 PM
Quote from: LordAdef on February 03, 2018, 01:19:29 PM
1. Why include \masm32\MasmBasic\Res\MbGui.asm must go after GuiMenu and What things wont work preceding the include (it took me a while to figure this was the reason the Menu wasn´t showing up).

The GuiParas and GuiMenu lines must come before the include simply because the internal WinMain proc must know what are the required settings. The include does its initialisation stuff then, and directly after you are right in the WM_CREATE handler, with GuiControl ... and similar.

Quote2. This line doesn´t seem to be doing anything:  GuiParas  equ "TreeView demo", x 70, y 0, w 55, h100, cblack,  b 0EEEEEEh
The GuiParas equate appears once before the include line. If it comes after that line, it will be ignored.

QuoteDon´t curse at me JJ, this is a crash course for MasmBasic Noobs! It will serve for others too   :greenclp: :bgrin::eusa_dance:
;)

Quote from: LordAdef on February 03, 2018, 04:14:50 PM
Next step is to search for proc names within the selected file.

I saw many possible instructions: FileRead$, FileOpen$, Open.  Seek,  ArraySearch and Trim looked useful.
What´s the best MB way of doing this?
Let esi=FileRead$(filename) gives you a fat buffer with file content. No need for Open or Seek then.
FileOpen$ gives you the dialog, not what you want here I suppose.
ArraySearch is a very specialised binary search; what you need here is Instr_(src, pattern, mode).

Take a look at Recall. Since you need to find things like MyTest proc args, your needs are more line-oriented:
Recall "thefile.txt", L$()
For_ ct=0 to L$(?)-1
  Let esi=L$(ct)
  .if Instr_(esi, "proc", 5)  ; mode 5: 1=case-insensitive, 4=full word
     PrintLine esi, " contains a proc"
     push esi
     ; from here on, you may need some "real" assembler examining esi ;-)
     pop esi
  .endif
Next


Note that Let esi=L$(ct) in a loop is legal code but you are responsible that esi is unchanged when you use Let esi= again in the next iteration, therefore the push esi/pop esi sequence.
Title: Re: SlimViewer, project in MasmBasic
Post by: LordAdef on February 04, 2018, 08:43:04 AM
So,

"For_ ct= 0 to lineMax -1"  gives "Error A2209: Count must be positive or zero"

I added the following lines:

SetGlobals lineMax:DWORD
mov lineMax, eax ; Min(eax, 20)  **** Number of lines ret in eax ****
                Print Str$("%i lines found in File ", lineMax)

to make sure Recall was getting it right. It was.

1. What´s happening JJ?

2. Can you set a variable without declaring it ? I used SetGlobals."Let lineMax = eax" is wrong too

3. We don´t need Init or include Masmbasic when using MBGui.asm, right? (I do know this one, but it´s good for the tutorial)

    ; --------------------------------------------------------------------------------------------------------------------------
;                                                        .... RECALL ....
; --------------------------------------------------------------------------------------------------------------------------

Recall "\masm32\AFprojs\__slimViewer\template.asc", L$()    ; Hard coded to test the functions


SetGlobals lineMax:DWORD
mov lineMax, eax ; Min(eax, 20)
                  Print Str$("%i lines found in File ", lineMax)
                   
For_ ct= 0 to lineMax -1
Let esi=L$(ct)
.if Instr_(esi, "proc", 5)  ; mode 5: 1=case-insensitive, 4=full word
  PrintLine esi, " contains a proc"
   push esi
;;  from here on, you may need some "real" assembler examining esi ;-)
   pop esi
.endif
Next


Title: Re: SlimViewer, project in MasmBasic
Post by: jj2007 on February 04, 2018, 09:49:40 AM
Quote from: LordAdef on February 04, 2018, 08:43:04 AM
"For_ ct= 0 to lineMax -1"  gives "Error A2209: Count must be positive or zero"
Check if lineMax is defined.

Quote2. Can you set a variable without declaring it ? I used SetGlobals."Let lineMax = eax" is wrong too
Normally not, but For_ ct=0 To whatever is an exception: no need to declare ct (but a REAL8 counter must be declared).
Let lineMax=eax won't work because Let is only for strings. Use mov lineMax, eax

Quote3. We don´t need Init or include Masmbasic when using MBGui.asm, right?
Correct, the Init is done internally. Here is full code with the right order of SetGlobals and Recall:

include \masm32\MasmBasic\Res\MbGui.asm
  Recall "\Masm32\include\Windows.inc", L$()
  SetGlobals lineMax
  deb 4, "lines", eax
  mov lineMax, eax
  deb 4, "lines", lineMax
  For_ ecx=0 To Min(20, lineMax-1)
        PrintLine L$(ecx)
  Next

Event Key
  deb 1, "You pressed", VKey
GuiEnd
Title: Re: SlimViewer, project in MasmBasic
Post by: LordAdef on February 04, 2018, 03:49:54 PM
Ok,

I´m using "endp" to fetch my procedure names. For now I don´t care if I´m getting false positives. All I want is a draft with functionality.

Recall "\masm32\AFprojs\__slimViewer\Text.asm", L$() ; Hard coded only to test the instructions
mov lineMax, eax ; Min(eax, 20)
For_ ct= 0 To lineMax    ; Min(1000, lineMax-1)   ;
Let esi=L$(ct)

.if Instr_(esi, "endp", 5)  ; mode 5: 1=case-insensitive, 4=full word
; returns relative pos in edx, absolute in eax
sub edx, 2 ; " e"(ndp)
mov eax, z$(Left$(esi, edx))
; PrintLine Left$(esi, edx)
deb 4, "¨", $eax
push esi
mov tvi.item.pszText, Chr$(byte ptr [eax])
invoke SendMessage, hMyTree, TVM_INSERTITEM, 0, addr tvi
pop esi
.endif
Next


- Instr_ returns me the relative position of "endp" in edx. Cool. 
- I "sub edx, 2" to get rid of " e"(from " endp") and what´s left is my proc name
- which can be saved into eax with this:   mov eax, z$(Left$(esi, edx))    
- deb 4, "¨", $eax  outputs all my target names!

- eax has it. I can insert the first byte of each procedure name: mov tvi.item.pszText, Chr$(byte ptr [eax])

I could easily get the full name with asm. But the idea is to be as MB as possible. So, how can I retrieve the whole string (pointed by eax)?


Title: Re: SlimViewer, project in MasmBasic
Post by: jj2007 on February 04, 2018, 07:41:03 PM
Your code works fine, Alex. A few remarks, as shown below:
- on entry into a For_ loop, you can use whatever register, including eax;
- instead of Let esi=L$(ct), you can use mov esi, L$(ct), thus avoiding to heapalloc an extra string. However, esi should be treated as a read-only pointer.
- Instr_() returns both the index in edx, and a pointer to the match in eax. In your case, the pointer is easier to use, see below.

include \masm32\MasmBasic\Res\MbGui.asm
  SetGlobals lineMax, tvi:TV_INSERTSTRUCT
  Recall "Whatever.asm", L$()     ; change
  mov lineMax, eax
  deb 4, "lines", lineMax
  For_ ecx=0 To eax-1           ; instead of lineMax, you can use eax
        mov esi, L$(ecx)
        .if Instr_(esi, "endp", 1+4)    ; case-insensitive, full word
                .Repeat
                        dec eax
                .Until byte ptr [eax]>="0"      ; find the tail of sometest<whitespace>endp
                mov edx, eax
                .Repeat
                        dec eax
                .Until byte ptr [eax-1]<=32     ; find the start of  CrLf<whitespace>sometest endp
                sub edx, eax     ; tail-start=#bytes
                inc edx
                mov tvi.item.pszText, z$(Left$(eax, edx))
                PrintLine "[", eax, "]"  ; replace with SendMessage, ...
        .endif
  Next

Event Timer    ; at least one event is needed
  Print "."
GuiEnd


8)
Title: Re: SlimViewer, project in MasmBasic
Post by: LordAdef on February 05, 2018, 07:22:18 AM
Nice Johen.
I made a small change in your code: For_ ecx ...  ecx gives error. I PUSHED and used edi instead and it worked fine
I filled the 3 Parents just for fun (it IS fun!). See the zip.
For that reason lineMax is good, for I can retrieve back into eax, for every parent feeding

Quote                                                   PUSH edi
                                                   mov eax, lineMax
                                                 For_ edi=0 To eax-1           ; instead of lineMax, you can use eax
                                                     mov esi, L$(edi)
                                                      .if Instr_(esi, "equ", 1+4)    ; case-insensitive, full word
                                                               deb 4, "¨", eax
                                                             .Repeat
                                                                      dec eax
                                                              .Until byte ptr [eax]>="0"      ; find the tail of sometest<whitespace>endp
                                                             mov edx, eax
                                                              .Repeat
                                                                      dec eax
                                                              .Until byte ptr [eax-1]<=32     ; find the start of  CrLf<whitespace>sometest endp
                                                             sub edx, eax     ; tail-start=#bytes
                                                             inc edx
                                                             
                                                              PUSH esi
                                                             mov tvi.item.pszText, z$(Left$(eax, edx))
                                                              invoke SendMessage, hMyTree, TVM_INSERTITEM, 0, addr tvi
                                                          ;  PrintLine "[", eax, "]"  ; replace with SendMessage, ...
                                                            POP esi
                                                      .endif
                                                Next
                                                POP edi

For the tutorial sake, here are the following questions and remarks I believe are relevant at this point:

1. It´s possible to create your own .data segment. I placed mine right below  "include \masm32\MasmBasic\Res\MbGui.asm" and it all seemed to be ok.
    Using the lineMax variable as an example, what would you choose: SetGlobals vs .data?

Quote         include \masm32\MasmBasic\Res\MbGui.asm                        ; It MUST go after GuiMenu. WHY JJ??

.data?
   lineMax      dd  ?
.code 
        ;SetGlobals lineMax:DWORD
        GuiControl Status, "statusbar", text "MasmBasic is easy"
Still on this topic, You wrote this: SetGlobals lineMax, tvi:TV_INSERTSTRUCT
   lineMax has no size. Does MB assumes it´s a dword?

2. Recall "\masm32\AFprojs\__slimViewer\Text.asm", L$()
       Is L$() a Global?
       How do we release the Recall (or close the file, free the memory, whatever is under the hood)?
       Say we want to Recall another file, Can we use L$ and overwrite the data in there?
3. Why MbGui.asm has MasmBasic inside and not the other way around?
4. Do you have plans on expanding GuiControls?
5. I forgot about this one: z$. It´s a porweful and useful one, but no reference in the help, Would explain it for us?
Title: Re: SlimViewer, project in MasmBasic
Post by: jj2007 on February 05, 2018, 08:51:31 AM
Quote from: LordAdef on February 05, 2018, 07:22:18 AMI made a small change in your code: For_ ecx ...  ecx gives error.
MB protects ecx, but any WinApi call will trash it. So
push ecx
invoke SendMessage, ...
pop ecx

is one option. Or use For_ ct=..., i.e. a global counter.

QuoteFor the tutorial sake, here are the following questions and remarks I believe are relevant at this point:
1. It´s possible to create your own .data segment. I placed mine right below  "include \masm32\MasmBasic\Res\MbGui.asm" and it all seemed to be ok.
    Using the lineMax variable as an example, what would you choose: SetGlobals vs .data?
The best option is to use local variables, but if that is not possible:
- SetGlobals is easy to declare and uses the .data? section for frequently used variables with short encodings of the form
mov eax, [ebx+n]. Advantage: compact code. Disadvantage: under the hood, it needs ebx as an index register, so ebx is not available for other things unless you push+pop it.
- "Real" global variables have longer encodings, 5 bytes instead of 3. Good for rarely used variables that must be globally available.

Quoteinclude \masm32\MasmBasic\Res\MbGui.asm MUST go after GuiMenu. WHY JJ??
GuiParas and GuiMenu are equates that are being used by MbGui.asm. So they must be defined before the include.

QuoteStill on this topic, You wrote this: SetGlobals lineMax, tvi:TV_INSERTSTRUCT
lineMax has no size. Does MB assumes it´s a dword?
Yes, exactly, but it's not MB-specific. Masm does the same for local variables and args of a proc.

Quote2. Recall "\masm32\AFprojs\__slimViewer\Text.asm", L$()
       Is L$() a Global?
When using Recall "some.txt", some$(), you get an array of strings, and arrays are always global.

QuoteHow do we release the Recall (or close the file, free the memory, whatever is under the hood)?
No need to release it. If you are short of memory, you may use Erase$ some$() (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1127), but normally it's not needed.

QuoteSay we want to Recall another file, Can we use L$ and overwrite the data in there?
Yes, the old array gets automatically heapfree'd, and a new one with the same name gets created.

Quote3. Why MbGui.asm has MasmBasic inside and not the other way around?
4. Do you have plans on expanding GuiControls?
3. MbGui is newer and relies on the full MB library.
4. In principle, GuiControls should already work with all kind of controls, but some are special. Right now I am working on a spreadsheet/table/grid control (the name is not yet decided).

Quote5. I forgot about this one: z$. It´s a porweful and useful one, but no reference in the help, Would explain it for us?
For Print and Let, MB uses an internal buffer for short strings, which allows e.g.
Let esi="Hello, now it's "+fTime$(0)+" on "+fDate$(0, "dd MMM yy")
The Let and Print macros have access to the internal structure that registers the order of the strings etc, and can thus produce compact and powerful code.
In rare occasions, you may want a direct pointer, example:
  mov eax, z$(Left$("abcde", 3))
  PrintLine eax

I haven't used z() for years, though. Be careful, check if it really works, and use Olly if in doubt. There is a reason why it is not documented; my advice: Use Cat$() instead, it's safer.
Title: Re: SlimViewer, project in MasmBasic
Post by: LordAdef on February 06, 2018, 03:46:59 PM
Hi Jochen, Here we go for a next batch!

I inserted a menubar, based on your template (and research here too). But before we go into it, let me cover some other things.

1.
QuoteGuiParas equ "SlimViewer", x650, y20, w800, h900, c black,  b 555555h      ; Last item == Bk colour
   ; GuiParas equ "SlimViewer", xr5, y5, w800, h-5, b RgbCol(160, 255, 200), m3   ; x right-aligned 5px, y5px, width 800, height-5px
The line below was taken from one of your examples. It´s a more elaborate function, with alignment. How many more things like that there is? And what´s the meaning of "m3"?

2. As you already know by my .asc files, I like the dark interface, kind of Visual-you-Know.. I managed to set my control´s backgrounds (including the treeView) dark, but couldn´t find a way to do it for the ComboBox (which appears to be a bit difficult) and the GuiControl static "labels" text to white. And out-of-curiosity, can the BKground of the Status and menu be darkened too?

3. If you run my *.exe, I´m recalling a .asc file (thus richtext). Although our filtre is doing a fine job when it comes to text files (asm), it´s getting richtext stuff like \tabs. I know when within the plugin enviroment, one can fetch a text format instead of the richtext. Is that the case or I must think of richText format hunting?

4. MenuBar!  I did a bit of hacking and managed to pull it into the prog. Nice! I placed everything needed into a folder to make it portable.

I tried to replace some of your icons, editing the excell .dat file. I succeeded with just one out of 4 icons (a pref icon, third from the right) and don´t know why (they are still written down at the excell .dat). I also couldn´t figure out if the 24 pixels is default and if I could overwrite it.

Talking about menuBars, it would be nice if you could elaborate a bit more. The tooltips are self-explanatory and are working rock-solid. It´s a nice bonus!


My first impression is so far well above my expectations. MasmBasic is huge and the entry point needs some digging (and that´s why this tutorial). There are times where one needs to just go for it. MasmBasic allows us to stay into the asm enviroment, but with the HLL productivity of some other languages. I can´t wait to see more developments in the GuiControls. That´s the catch.

The immediate right-click help for masmbasic when working with Richmasm is great! I´m using all the time. Not to mentioned that deb4 is my newest pal.
Congratulations Jochen, amazing work.

ps: http://masm32.com/board/index.php?topic=6890.msg73796#new (http://masm32.com/board/index.php?topic=6890.msg73796#new)  <== Check this out. I found a solution in a free app. But I could simply hava done it with a GuiControl excell.... That´s what I mean.
ps2: it´s worth those extra 20kb... :badgrin:
Title: Re: SlimViewer, project in MasmBasic
Post by: jj2007 on February 06, 2018, 06:48:55 PM
Quote from: LordAdef on February 06, 2018, 03:46:59 PM1.
QuoteGuiParas equ "SlimViewer", x650, y20, w800, h900, c black,  b 555555h      ; Last item == Bk colour
   ; GuiParas equ "SlimViewer", xr5, y5, w800, h-5, b RgbCol(160, 255, 200), m3   ; x right-aligned 5px, y5px, width 800, height-5px
The line below was taken from one of your examples. It´s a more elaborate function, with alignment. How many more things like that there is? And what´s the meaning of "m3"?

m3 is margin 3px. Try m30 to see the difference. For "more things", check GetGP macro in the include file; but you pretty much covered it.

Quote2. As you already know by my .asc files, I like the dark interface, kind of Visual-you-Know.. I managed to set my control´s backgrounds (including the treeView) dark, but couldn´t find a way to do it for the ComboBox (which appears to be a bit difficult) and the GuiControl static "labels" text to white. And out-of-curiosity, can the BKground of the Status and menu be darkened too?

Probably, using the appropriate functions and messages, such as WM_CTLCOLOR etc.

Quote3. If you run my *.exe, I´m recalling a .asc file (thus richtext). Although our filtre is doing a fine job when it comes to text files (asm), it´s getting richtext stuff like \tabs. I know when within the plugin enviroment, one can fetch a text format instead of the richtext. Is that the case or I must think of richText format hunting?

                ; Recall "slimViewer.asc", L$()                 ; Hard coded only to test the instructions
                GuiControl MyRE, "Richedit", x0, y0, h0, w0
                invoke ShowWindow, hMyRE, SW_HIDE
                SetWin$ hMyRE=FileRead$("slimViewer.asc")
                StringToArray Win$(hMyRE), L$()
;)

Quote4. MenuBar!  I did a bit of hacking and managed to pull it into the prog. Nice! I placed everything needed into a folder to make it portable.

I tried to replace some of your icons, editing the excell .dat file. I succeeded with just one out of 4 icons (a pref icon, third from the right) and don´t know why (they are still written down at the excell .dat). I also couldn´t figure out if the 24 pixels is default and if I could overwrite it.

Talking about menuBars, it would be nice if you could elaborate a bit more. The tooltips are self-explanatory and are working rock-solid. It´s a nice bonus!

I was surprised to see it in your app - you are learning really fast :icon14:
Re icons, I would have to check my old files how I did it. May take a while since I am very busy right now.

What I can see so far is that your xlsx file is current, but GuiData\IdeData.tab is old. MB cannot read the complex xlsx format, it needs simple tab-delimited plain text. So you need to export your edits. Inside the spreadsheet, line 43 contains the instructions which icon to use where:
USE: [45D2  016GC  78  AB  Ee100 He100 s200]
You recognise the structure of the toolbar...? The numbers and letters are the first column in line 49ff.

QuoteMy first impression is so far well above my expectations. MasmBasic is huge and the entry point needs some digging (and that´s why this tutorial). There are times where one needs to just go for it. MasmBasic allows us to stay into the asm enviroment, but with the HLL productivity of some other languages. I can´t wait to see more developments in the GuiControls. That´s the catch.

The most common controls are "implemented"; in reality, all controls can be created, but you may have to use more low-level calls to program them. SendMessage is your friend ;-)

QuoteThe immediate right-click help for masmbasic when working with Richmasm is great! I´m using all the time. Not to mentioned that deb4 is my newest pal.
Congratulations Jochen, amazing work.

Thanks ;-)

QuoteI could simply hava done it with a GuiControl excell.... That´s what I mean.
ps2: it´s worth those extra 20kb... :badgrin:

I can't use that name, of course. What do you suggest? Attached some work in progress. Select a cell and type e to edit it. The scroll bars are not working, it's damn complex, unfortunately. What's the best name for it?
GuiControl MyData, "table", ...
GuiControl MyData, "spreadsheet", ...
GuiControl MyData, "grid", ...
Title: Re: SlimViewer, project in MasmBasic
Post by: LordAdef on February 07, 2018, 07:29:01 AM
I like GuiControl MyData, "grid"  a lot, but maybe GuiControl MyData, "spreadsheet" is more indicative and clearer.

And grid may be used later for some grid macro yet to come  :biggrin: