PDA

View Full Version : Tutorial on importing functions to existing controls and more?



ReneMiner
29-04-2020, 21:26
Does anyone know how to load ocx - controls Into Ui - what limitations and how would the callback work on them ? Can I give them names to access the basic functions?Or how on already accessible controls in tb - let's say I want to use another method to retrieve the data from listview then to peek each value seperate but it's not only declare function. It's difficult to post an example from mobile... So some all-round information would be nice. The onlysample uses idisplatch and I do not understand what it does. Eros mentioned tb can load any windows- controls, but it's as with the textbox in UI. It provides basic functions but as soon as I need something exactly- where I find maybe cursorpositio or select a part of text visually then itLacks all the required functions. Can someone please give an example how to transfer the function in a way that it works so I can see how to proceed. And what about these ex- controls. Thinbasic provides the menus but not menuEx that offers also icons or few controls besides option buttons and checkboxes but can have sliders, scrollbars and even expand to a canvas or console within the menu?I see already too many questions? Which part should I cut?And I look around to find

Petr Schreiber
30-04-2020, 19:39
Hi Rene,

I think you can use any "low level" Win32 controls for sure, but I think OCX ones are ActiveX and I don't remember them being mentioned as supported.


Petr

ReneMiner
01-05-2020, 05:25
supported yes sure since the last of 1.10-versions or early 1.11 - there is something as Control Add ActiveX but i think i ve overseen some clue...
Anyway i discovered something very interesting in Open Office - which now is called LibreOffice has built in a few controls - especialy interesting a free configurable spreadsheet table controllable inside the open office . sorry- LIBO- with some apache 2 basic dialect thats at least 99% compatible to Visual Basic 6. In the other direction we must use Option Base 1 inside the apache-editor to have it 1-based but you must keep in mind that if you would usually Dim x(10) they create 11 array-elements of x. If you use Option Base 1-directive it will be 1-based but create x(1) to (11) when You DIM X(10)
And their strings limited to 64kB - anything else thinBasic is able to cover 100% when you have a routine to

make equates from Const A to Const Z to Const %A to Const %Z
find "(Dim)\s* [A-Za-z]([0-9A-Za-z_]){,*}\$ and append " As String"
because They can "Dim Abc123$" and the $-sign fixes it to String already.

The controls have events- and some dll or lib. I know for sure i can use old vb6 together with a linker controller to make the apache-basic file become a dll that i can access as were it a .tBasicU (except thinair will not show functions but i think they have so many binds to different languages and it should be possible to write the thing in thinbasic instantly. it provides a very easy way: you have a property-list where is all events that the current type of control has listed. You draw your control, go to the apache-basic-codewindow - Write like Sub OnLostFocus, go back to the dialog-editor, open a dropdown-list at your controls propertie-list and select OnLostFocus for this control. You can reuse the sub for any other control but i would recommend this only to use if for the same typeOf control - what brings me to the point: create udts-1 for each type of control that all "extends" a common basetype-udt which has



Type tLocation
X As Long
Y As Long
End Type

Type tSizeL
W as Long
H as Long
End Type
' - - - - - - - - - you must Alias DWord As Long in Apache2
Type tCtrlBasic
hWin As DWord ' win-handle (controls get a handle assigned by windows - store here)
hParent As DWord ' the handle of parenting window or viewport store here
pName As Dword ' here goes the pointer where the objects name is stored
lIndex(3) As Long ' can give the object indexes in 3 dimensions,useful to have that option
lLoc As tLocation ' this the location (Long X, Long Y )type from above
lSize As tSizeL ' another that holds size (Long W, Long H) also above
pText As Dword 'many items have a text or caption. If not used its free to store 2 GB of user-data...
Style As Long 'almost anything has those 2 in Windows
ExStyle As Long

Function Text$(Optional Byval sText = As String mkbyt$(0)) as String
'This will optional assign new text and always return text .
' the zero-byte is to know if you passed "" to delete the text or if you passed nothing only
End Function
End Type


now its to create basic functions on the basic type since i can store Style when i created the object.
but for the user at the end it needs a function to set whatever that style does. Mostly setting border appearance, scrollbar-behaviour etc. Anyway the basetype will only care for those that affect his properties. see Text$(). All must have functions to get and set their properties and to set new passed value to the control or window. The udt will provide the wrapper but this udt can not be used like that for advanced controls. It will not even serve for a window inside a viewport because it lacks properties for a client. So

The pointer- instead of the name directly in the udt provides few advantages: if you had 100 pictures you name and index them myPicture(10,10)
now they all have the same 4Bytes-Pointer to the same name. You can see if you compare pointers if they are of the same type. If storing 100 times 8 bytes or 4... makes a few bytes. And you dont easily change a controls name the Name$ function will not do it and it will maybe have to add 123456 to every pointer or to subtract -7654321, i guess the name-check-in function will not release the very first pointer which would be the number that has been subtracted before you got the pointer to store it :)
And: all these base-types are equal in size. None of them has any dynamic string-
just to make it Simple 2 small different types:



Type tButton Extends tCtrlBasic
Checked As Dword
End Type

Type tOption Extends tCtrlBasic
Checked As Long
pPrevious As Dword
pNext As Dword
End Type


The tButton-type, a simple pushbutton but in real just a simple checkbox or button without picture needs a function to check and uncheck. All other abilities are in the basetype

The option button will be made from the basic type too- it will need a different function than a checkbox when its checked and it has to point the previous option (or 0 if its the first) and also the next option so if it gets checked all options must point to their alternatives left and right or above and below because the neighbours must be unchecked the moment that checkbox gets checked...

yeah ouhh... typed so much again--- best i give you few links and some to study if anyone only wants to use the spreadsheet -table control (i think it can excel and better than) you will need to download next to the LibreOffice (https://www.libreoffice.org/)_6.x.x_Win_x(86|64).msi (~300MB) also the Helppack- in your language (~3MB) with it, then the sdk (https://api.libreoffice.org/) (~23MB) is mandatory if you want to develop anything ( do not forgetto look for the API-documentation and if you just want to snoop in there are flat installation-packs and portable versions.
I would recommend also to add the expansions (https://www.libreoffice.org/discover/templates-and-extensions/)
codehighlighter.oxt(22kB) + enhancedForm1.12.oxt(63kB)

for xDialobox-...-oxt(80kB) is jre (Java Runtime) required to run- if you do not have it you still could study scripts or use the script-templates of it and copy it into your script.

If you have knolwedge about C# or Python - its implemented also but i stick with basic .
To see if its your taste of basic- i append the help that you would have to find seperately in some wiki-corner of whatever.

I think it is possible to take the controls of that for use in tB as well as to use tB as scripting language for the whole libreOffice suite and provide menus to the dialogs. Anyway interesting to study their properties & functions assignement that will fit very good with controls names because it makes sure that all callbacks are correctly named and assigned.

I hope you enjoy

Petr Schreiber
01-05-2020, 09:04
Wow, you are correct, Rene! Shame on me!

I think for more advice we need to wait for Eros, but I am afraid it will take some time - he is experiencing true hardcore mode at work currently.


Petr

ReneMiner
07-05-2020, 21:56
To be honest I think it's a shame that the quite normal, easy to understand stuff is splattered with coding examples and how to use these. The result: everyone is safe in using these, no doubts how it has to be used. and we have like 2000 cool undocumented functions that are not documented. I will not dare to ask how many suggests each of us has made already that are already developed and Ava.But no one know them nor how to use these. Its really a waste of functions are developed that none knows how to use them. So the implementation of ocx controls ok- they are still part of the current OS but microsoft tends obviously to encrypt everything into flat XML -nuget and that might be a flexible way but you will experience as I do already encryption, a buggy bitlocker that locks bits literally into the surface of devices that will never unlock anymore and make you lose a few kilobytes of your hd every day. And the XML is so fast filled with unwanted changes that those controls will not even work until their expiration date. Another nonsense invented to make more money faster. Come on, that are bytes and no food. Dr this website. It will not be ruined or start smelling funny. And ethics habit getting worse to worst. Now if there was a expiration date on functions and it says they are not safe to use them man function there have never been documented will never have a chance to get used. We might have the machine to generate the code about meaning of life - but no one knows how to use it and it will be demolished soon to have space for an intergalactic highway that has a macdongles flythru every 2.5 light-years and yes you all could insist an protest against thse plans. Goto Redmond Washington and pin Out protest at the blackboard in floor 17a of building 42. You still have 3 day s.left if and the list is open for your entries since 1995. you had for sure enough not time to explain you're points. If not , forms to fill up building 42 are still available in the office of Mrs Sanchez prized who was her office in Springfield,, Wisconsin actually she complained already about no one knocks the door before entering so she announced that the her door will stay locked the whole next week.thank you for your patience and cooperation

ReneMiner
11-05-2020, 12:33
Yes that was a bit sarcastic, and typed on the mobile phone where auto-correction more encrypts than to correct.
But it's with those many undocumented things like maybe few know the other languages where the functions were adapted from but most - and especially new users do not know what it is about.
Trying to find out is mostly leading to depressing and just time consuming discovery how it doesn't work. And coding should be fun and give a feeling of successfully solving a problem. Everyone will change to use something else if the thing he tried does not work after hours of attempting without any success. It's a condition to continue. If not solved the problem using Tool A the user will grab for Tool B or forget his plans. Maybe it will help to create a bunch of pages that can be inserted into the help . But no-one has the time. And those who have the time are not sure how to use the functions...

DirectuX
11-05-2020, 14:48
Yes that was a bit sarcastic, and typed on the mobile phone where auto-correction more encrypts than to correct.
But it's with those many undocumented things like maybe few know the other languages where the functions were adapted from but most - and especially new users do not know what it is about.
Trying to find out is mostly leading to depressing and just time consuming discovery how it doesn't work. And coding should be fun and give a feeling of successfully solving a problem. Everyone will change to use something else if the thing he tried does not work after hours of attempting without any success. It's a condition to continue. If not solved the problem using Tool A the user will grab for Tool B or forget his plans. Maybe it will help to create a bunch of pages that can be inserted into the help . But no-one has the time. And those who have the time are not sure how to use the functions...

:scenic: That's a good point toward collaborative documentation...

isn't it, Petr ? :wink:

Petr Schreiber
14-05-2020, 21:39
It is - we are evaluating options with Eros. I even prepared a proof of concept, generating HTML page for help file, but it is not there yet, there were mistakes.

I am not sure when I will return to it, but the bottom line is - I agree it would be incredibly helpful, if users could propose changes directly/easily/in some normalised form.

The currently used tool for thinBASIC help is super expensive, we cannot expect thinBASIC users to buy it just to help.

I would like to ask for patience, as we both with Eros are under heavy load at work. I hope to get back to it during summer. The tasks is not complicated, we just need a peace of mind to move with it. Keep your fingers crossed.


Petr

DirectuX
14-05-2020, 22:16
Keep your fingers crossed.

That won't be easy to code, Petr.

:blush:

ReneMiner
15-05-2020, 02:02
For the super-expensive help- my help-authoring software is for free and the compiled results look the same way as the hellpfiles made by Eros.

It's help'n'Doc free for personal use.
https://www.helpndoc.com/EN/ (https://www.helpndoc.com/it/) English
https://www.helpndoc.com/FR/ (https://www.helpndoc.com/de/) Francais
https://www.helpndoc.com/ES/ (https://www.helpndoc.com/de/) Espanol
https://www.helpndoc.com/de/ Deutsch
https://www.helpndoc.com/download/

To compile the results would be better not to compile the pages but import them to Online-help as well as in Eros Help-Authoring tool and compile the final version then. But if you need a compiler that will make it HTML
(CHM is compressed HTML so it works with the same compiler.)
Get your free Compiler with HTML Help Workshop - shipped with visual basic 6 in 1998 but still free available at
Microsoft if you do not have a VB6.0 nor VisualStudio 98.
Actually Help'nDoc works fine without to install it.

I still have same installation since 1 year but i changed maybe 30 times my OS. Help'n'Doc was never installed to my current system but works without any problem so for the friends of portable software this might be something you dont have yet. From HTML-Work-Shop you actually need 2 Files (HHA.DLL and HHC.EXE) so no need to install it since the handling is very poor its no fun to use it.
But the compiler will do its duty while HelpnDoc is Editing in WYSIWYG-style.

Use 7z in case you have this software on an ISO and you cann extract these 2 files using 7z instantly from iso. There are 2 Versions of the HTML-Work-Shop - the first came 1998 and the renewed version in 2004/2005. This you can get at

Microsoft in an online-installer (https://www.microsoft.com/en-us/download/details.aspx?id=21138) if you go there with a windows computer. Check the link on an Android-phone or with a Linux or iCrap-device to access the offline installer package or you can obtain it within old versions of SP6 for VB6 as package also.
those 2 files and put them into the Help'nDoc main-folder. Then open Help'nDoc go to OPTIONS which hides deep down in the FILE-MENU, the dialog that opens has 4 tabs. The second one is Compiler and here you can navigate to point HHC.Exe location.(barely to see on my system it has [...] on the right to shell a browser-dialog.
If you want also to compile PDF it needs only a DLL that either can be used from ADOBE or FOXIT while foxit PDF is also available as portable version some might prefer it. Anyway if you only need the PDF-creator-dll no need to install.
And a last hint (many know) grab yourself a copy of 7z. Its essential.
Look that you grab the correct version, either x86 or x64. 7z will unpack the helpfile that is shipped with thinBasic and make it like 3500 <single pages if you instantly include TBGL, TBDI and TBAI.

We have a few pages that get lost. Thats due the Pages have the same top-line. Meaning for example there is the Page for SHELL-command in general section of core-module. It was made from a copy of the ALERT-keyword pageand forgotten to change the title. So the real alert and the shell-page will be saved withsame name. If 7z will prompt because there is a file that would be overwritten select the automatic rename-option then you have an Alert.htm andan Alert2.htm. If you choose overwrite - the first file will be lost
And things as Shell_CaptureOutputor almost all topics of WCon do not have a scrollbar to move the content up and down. So everyone has a tool to work with now? OK, Get ready, ... set help... and TYPE!

Petr Schreiber
15-05-2020, 07:00
That won't be easy to code, Petr.

:blush:

I do not say the final form will be custom script :)

To give you info about how I work around the situation with TBGL help file:
I use ASCII format to specify documentation for keywords -> translator to HTML -> HTML help workshop to compile it.

All it takes to maintain the docs is usually:
- edit the text file for given topic(s)
- click make_all script, which recompiles everything to HTML and launches HTML Help Workshop tool

The advantage of having all data in neutral format + converter is independence on given tool. If one day Microsoft stops supporting CHM help files, I can adjust it to generate another format with less pain, than de-constructing the HTML files.

I think I could open at least this part easily during summer, allowing you to propose changes via Pull requests. Sounds good?


Petr

DirectuX
15-05-2020, 08:57
allowing you to propose changes via Pull requests

changes to the neutral format data ?

Petr Schreiber
16-05-2020, 10:34
Yes, exactly. It has text form, so the difference is easily visible.

Thanks to GitHub Actions, an Windows agent could be spinned, publishing new version of the adjusted help file (this is not verified, but would like to have).


Petr