• Welcome to PlanetSquires Forums.
 

José, if you're bored...

Started by Paul Squires, August 02, 2018, 09:19:19 PM

Previous topic - Next topic

José Roca

Hi guys, if you're bored... you can test a new data type, CInt96.

CInt96 is a wrapper class for the DECIMAL data type. Holds signed 128-bit (16-byte) values representing 96-bit (12-byte) integer numbers. The largest possible value is +/-79,228,162,514,264,337,593,543,950,335.

Documentation: https://github.com/JoseRoca/WinFBX/blob/master/docs/Numeric%20datatypes/CInt96%20Class.md

Johan Klassen

hello José Roca
my small test show that it works ok, tried both 32 and 64 bit, thanks José

José Roca

Thanks for testing. There are many big numbers libraries, but this class if fast, and 29 digits should be enough for most tasks.

José Roca

#168
New class: CMemMapFile (memory-mapped files).

Documentation:
https://github.com/JoseRoca/WinFBX/blob/master/docs/File%20Management/CMemMapFile%20Class.md

Wikipedia article:
https://en.wikipedia.org/wiki/Memory-mapped_file

Usage example:

Example
The following code maps the contents of the ansi file "textA.txt", retrieves access to the data and converts it to lower case.


#INCLUDE ONCE "windows.bi"
#INCLUDE ONCE "Afx/CMemMapFile.inc"

DIM pMemMap AS CMemMapFile
IF pMemMap.MapFile(AfxGetExePath & "/testA.txt") THEN
   DIM pData AS ANY PTR = pMemMap.AccessData(100)
   IF pData THEN
      CharLowerBuffA(pData, pMemMap.GetFileSize)
      pMemMap.UnaccessData
   END IF
   pMemMap.Unmap
END IF


Unicode:


#INCLUDE ONCE "windows.bi"
#INCLUDE ONCE "Afx/CMemMapFile.inc"

DIM pMemMap AS CMemMapFile
IF pMemMap.MapFile(AfxGetExePath & "/testW.txt") THEN
   DIM pData AS ANY PTR = pMemMap.AccessData(100)
   IF pData THEN
      CharLowerBuffW(pData, pMemMap.GetFileSize)
      pMemMap.UnaccessData
   END IF
   pMemMap.Unmap
END IF


José Roca

#169
CMaskEdit: Fixed a problem with Undo not working after deleting characters.

José Roca

CMaskedEdit

- Removed the DisableMask method. It was causing many problems and it is not needed: if you want an standard edit control, use it instead of a MskedEdit control with the mask disabled.

- Changed SetWindowText to SetText, GetWindowTextLength to GetTextLenght, and GetWindowText to GetText.

- Added SetMaskedText.

- The cursor now is positioned automatically at the beginning of a group, without having to call SetPos.

Documentation updated:
https://github.com/JoseRoca/WinFBX/blob/master/docs/Windows%20GUI/CMaskedEdit%20Class.md

Paul Squires

Hi José,

Just starting to use the new masked edit control and integrate it into the WinFBE visual designer. I am integrating the control's properties and methods. Here are some of my initial thoughts (your thoughts on these would be appreciated)....

EnableGetMaskedCharsOnly - is this redundant? The GetText method allows retrieving text with or without the mask via the optional true/false bGetMaskedCharsOnly parameter. Why include this property?

SetMaskedText - why not just use SetText and add an additional true/false parameter that specifies that the pointed to text has (or doesn't have have) a mask in it? This would be consistent with the logic used by GetText.

GetTextLength - doesn't seem to be documented in your GitHub docs repository.

Thanks for your hard work on this control. It be a great addition to the visual designer!

Paul
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

#172
Welcome back! I was waiting for your input before doing cleanup. Meanwhile I have been experimenting with Oxygen Basic because this forum is dead if you're on vacation.

I first tried to mimic the original control, then I changed several things and now I have implemented your suggestions and updated the documentation.

Paul Squires

:-) I have been back a couple of weeks now but busy getting up to speed with my regular day job. Finally have time now to get back at the editor. I have noticed your activity with Oxygen Basic.

One thing I have been toying with is documentation. I love the markdown approach to documentation but the only downside is viewing it when you're offline (exporting to pdf doesn't always look good). I have been thinking of using a markdown parser to convert the markdown to html and then combine it with the github markdown css. Finally, display it all in an embedded web browser control within WinFBE. In theory, it all seems to be do-able and would make for a nice help system rather than CHM files.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

I'm using markdown because I can made changes to the documentation instantaneously, instead of having to prepare new .chm files. Besides, HelpNDoc is awfully slow with big help files like the WinFBX documentation and Help+Manual is expensive.


Paul Squires

I agree 100%. I was using markdown a bit for my winformsx documentation before I switched to pdf. It was so incredibly easy to write and looks really nice. I think we can leverage the markdown format to get something working nicely inside WinFBE that should easily display your existing markdown files as well as be easily expandable for the long term. I have always hated the whole process of creating CHM files.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

Added an small change to the new overloaded SetText function (I was doing nothing with the bSetMaskedCharsOnly parameter).


' ========================================================================================
' Sets masked text to the control.
' ========================================================================================
PRIVATE FUNCTION CMaskedEdit.SetText (BYREF cwsText AS CWSTR, BYVAL bSetMaskedCharsOnly AS BOOLEAN) AS BOOLEAN
   DIM cws AS CWSTR = cwsText
   IF bSetMaskedCharsOnly THEN
      FOR i AS LONG = 1 TO LEN(m_strInputTemplate)
         IF MID(**cws, i, 1) = MID(**m_strInputTemplate, i, 1) THEN MID(**cws, i, 1) = "_"
      NEXT
      cws = AfxStrRemoveAny(cws, "_")
   END IF
   FUNCTION = this.SetText(cws)
END FUNCTION
' ========================================================================================


Paul Squires

Quote from: Paul Squires on October 14, 2018, 06:02:38 PM
...I have been thinking of using a markdown parser to convert the markdown to html and then combine it with the github markdown css. Finally, display it all in an embedded web browser control within WinFBE. In theory, it all seems to be do-able and would make for a nice help system rather than CHM files.
We already have code in your Templates folder to create and embedded web browser and display either a html string or file. It might now just be a case of adding a client side javascript code file to take the string/file and render the markdown as html in the embedded browser. Something like showdownjs or markedjs might do the trick.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Okay, here is what my approach will be to the help/documentation for WinFBE and WinFBX, etc.

Instead of CHM files, I am building a form that will show a treeview on the left, a tab control on top, and an embedded web browser control on the right. The tab control will have tabs for "WinFBE", "WinFBX", etc...  Depending on what tab is selected, the treeview will display the folder structure of the help files. When a file is selected then that help topic will be rendered in the embedded web browser.

To generate the HTML files to display in the web browser, I will run all the documentation markdown files (*.md) through a batch converter to create standalone stylized HTML files in the exact same format as GitHub markdown. This is accomplished via this process:

Use Pandoc to batch convert the markdown files to HTML
https://pandoc.org/

The command line looks like (ran via a batch file):
pandoc -f markdown -t html5 -o "%2" "%1" -c ".\github.css" --self-contained

%1 is the input markdown file
%2 is the html file

The "github.css" is the specific stylesheet that gives the final HTML file its look and feel of a github markdown file. I am using the css from:
https://github.com/otsaloma/markdown-css

Using this approach it will be easier to create help documentation for WinFBE and the visual designer, as well as easily work with Jose's new markdown files that he is using to document the WinFBX library.





Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer