GUI input box

Windows specific questions.
deltarho[1859]
Posts: 532
Joined: Jan 02, 2017 0:34
Location: UK

GUI input box

Postby deltarho[1859] » May 08, 2017 16:14

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.
Josep Roca
Posts: 158
Joined: Sep 27, 2016 18:20
Location: Valencia, Spain

Re: GUI input box

Postby Josep Roca » May 08, 2017 16:54

It is your lucky day. Just a few days ago I wrote one.
See: http://www.planetsquires.com/protect/fo ... 8#msg30288
deltarho[1859]
Posts: 532
Joined: Jan 02, 2017 0:34
Location: UK

Re: GUI input box

Postby deltarho[1859] » May 08, 2017 17:46

It is your lucky day. Just a few days ago I wrote one.

That is so spooky.

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
Image
followed by
Image
St_W
Posts: 1057
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: GUI input box

Postby St_W » May 09, 2017 14:29

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>
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: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.
Thanks to contributions like José's InputBox the difference should get smaller and smaller.
deltarho[1859]
Posts: 532
Joined: Jan 02, 2017 0:34
Location: UK

Re: GUI input box

Postby deltarho[1859] » May 09, 2017 15:30

Thanks for the hint.

Thanks to contributions like José's InputBox the difference should get smaller and smaller.

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>

I also use Paul Squires' String functions (32/64 bit ANSI only). PowerBASIC had a definite edge on string functions - but not now.
Josep Roca
Posts: 158
Joined: Sep 27, 2016 18:20
Location: Valencia, Spain

Re: GUI input box

Postby Josep Roca » May 09, 2017 16:26

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.
deltarho[1859]
Posts: 532
Joined: Jan 02, 2017 0:34
Location: UK

Re: GUI input box

Postby deltarho[1859] » May 09, 2017 17:22

If we want to attract international users, unicode support is a must.

Yep.

I now have 27 plus '*** INPUT BOX DIALOG ***'.

Many, many thanks - exceptional work.
St_W
Posts: 1057
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: GUI input box

Postby St_W » May 09, 2017 19:34

Josep Roca wrote:If we want to attract international users, unicode support is a must.
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 :-)
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.

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 1 guest