I was wondering how quickly I could write a FreeBASIC version of RunSwitch.exe; used in the 'Run with switches' thread. It has turned out not as quick as I thought because I could not find a GUI input box. I looked in the FreeBASIC manual, searched the forum and searched the bi files to no avail. Never mind, I thought, I will use Jose Roca's CWindow class as I had done with the PowerBASIC version of RunSwitch. I used Jose's input box as the PowerBASIC input box is, to my mind, unsightly. Jose's input box is not in his FreeBASIC headers.
I could use 'Input [;] ["prompt" ,|; ] variable_list' but I want a GUI input.
Before I embark on my own, is there a FreeBASIC GUI input box? Perhaps my search parameters are incorrect.
GUI input box
-
- Posts: 4315
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
-
- Posts: 564
- Joined: Sep 27, 2016 18:20
- Location: Valencia, Spain
Re: GUI input box
It is your lucky day. Just a few days ago I wrote one.
See: http://www.planetsquires.com/protect/fo ... 8#msg30288
See: http://www.planetsquires.com/protect/fo ... 8#msg30288
-
- Posts: 4315
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: GUI input box
That is so spooky.It is your lucky day. Just a few days ago I wrote one.
FreeBASIC now has a GUI Input box. <Very big smile>
Added: I loaded CWindow.inc into TextPad, added Jose's new code but got access denied when trying to save it. Not surprising as I have my system set up like Fort Knox. Maybe I would anyway. Got round it by saving to the desktop and then used drag & drop with admin rights. There is always a way, isn't there. <smile>
More added: BTW, FreeBASIC's Shell command was not much good with regard a FreeBASIC version of RunSwitch so I used the Windows API ShellExecute. All in all it took me quite a bit longer to write than I thought it would. PowerBASIC had the edge on this exercise. It will happen and vice versa.
Code: Select all
#INCLUDE ONCE "Afx/CWindow.inc"
DIM Result as String
Result = AfxInputBox(0, 0, 0, "MyProg's input", "Type what ever you like", "")
MessageBox( null, Result, "MyProg", mb_ok )
And I get
followed by
Re: GUI input box
Hint: use Notepad++ instead of Editor and install the "SaveAsAdmin" plugin for Notepad++. This will automatically request admin rights if saving the file as restricted user fails.deltarho[1859] wrote:I loaded CWindow.inc into TextPad, added Jose's new code but got access denied when trying to save it. Not surprising as I have my system set up like Fort Knox. Maybe I would anyway. Got round it by saving to the desktop and then used drag & drop with admin rights. There is always a way, isn't there. <smile>
Thanks to contributions like José's InputBox the difference should get smaller and smaller.deltarho[1859] wrote:All in all it took me quite a bit longer to write than I thought it would. PowerBASIC had the edge on this exercise. It will happen and vice versa.
-
- Posts: 4315
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: GUI input box
Thanks for the hint.
I also use Paul Squires' String functions (32/64 bit ANSI only). PowerBASIC had a definite edge on string functions - but not now.
José sneaked CWindow Release Candidate 27 in whilst I wasn't looking - I am on 26. The InputBox will probably be in 28 but I couldn't wait. <smile>Thanks to contributions like José's InputBox the difference should get smaller and smaller.
I also use Paul Squires' String functions (32/64 bit ANSI only). PowerBASIC had a definite edge on string functions - but not now.
-
- Posts: 564
- Joined: Sep 27, 2016 18:20
- Location: Valencia, Spain
Re: GUI input box
Equivalent string functions that also work with unicode can be found in the AfxStr.inc file of my framework. Everything that I'm writing with FB is unicode aware. If we want to attract international users, unicode support is a must.
-
- Posts: 4315
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: GUI input box
Yep.If we want to attract international users, unicode support is a must.
I now have 27 plus '*** INPUT BOX DIALOG ***'.
Many, many thanks - exceptional work.
Re: GUI input box
I fully agree. Unicode support is such an important feature nowadays that should be integrated into the compiler and its runtime library rather than having an external (3rd party) library for it. Don't get me wrong, having that feature in a library is great. Thank You very much for providing such libraries - even for free. But IMHO having that feature in the compiler would be even greater :-)Josep Roca wrote:If we want to attract international users, unicode support is a must.
So maybe people like you, who are obviously able to build great things (as we can see), may eventually consider to contribute directly to the compiler / runtime lib so that such features eventually make their way into the offical FreeBasic package. Of course that's a totally new concept if you're coming from closed-source compilers (like PowerBasic) where one can usually influence the compiler development only in a very limited way, but it may be a long-term perspective.