LB Booster
« Grid of Textboxes using Windows API »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:21am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1 2 3  Notify Send Topic Print
 veryhotthread  Author  Topic: Grid of Textboxes using Windows API  (Read 65 times)
SarmedNafi
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 93
xx Re: Grid of Textboxes using Windows API
« Reply #5 on: Jul 23rd, 2016, 03:22am »

Dear Ray,

One day we were playing a game, me and my nephew, the moment he came back from school, I said come take this game from me and cousin don't go in this street you will spend two hours then you will find it close. He was smarter than me, he was always found us solutions to save our life (inside games).
After a quarter of an hour I came to found him inside all dirty of that street!
In general the humans by native were not able to take experience from others.
I think a grid built either by normal text boxes or by LBB loop or by one line of normal text boxes then passed to multi column ListBox are better a thousand times than a grid of API. I think you are going to west many years of your life.
Please reconsider this matter.

With all respects
Sarmed
« Last Edit: Jul 23rd, 2016, 03:24am by SarmedNafi » User IP Logged

RNBW
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 106
xx Re: Grid of Textboxes using Windows API
« Reply #6 on: Jul 23rd, 2016, 09:05am »

on Jul 23rd, 2016, 03:22am, SarmedNafi wrote:
Dear Ray,

One day we were playing a game, me and my nephew, the moment he came back from school, I said come take this game from me and cousin don't go in this street you will spend two hours then you will find it close. He was smarter than me, he was always found us solutions to save our life (inside games).
After a quarter of an hour I came to found him inside all dirty of that street!
In general the humans by native were not able to take experience from others.
I think a grid built either by normal text boxes or by LBB loop or by one line of normal text boxes then passed to multi column ListBox are better a thousand times than a grid of API. I think you are going to west many years of your life.
Please reconsider this matter.

With all respects
Sarmed


Sarmed

You misunderstand my reasons for investigating using the Windows API.

If you look back through LB and LBB postings you will find that I tried to develop a grid using textboxes in LB Conforums. Without moving into the realms of graphics and other devious means involving lots of code, this could not be done because of the way LB used manhandled. Richard Russell kindly put me right providing examples of how it was done using LBB.

Since then, I have been developing code using Freebasic and in particular using a library, WinGUI.bi, which is based on the Windows GUI. It is a simple library and is aimed at providing only the basics of editboxes, statictext, listboxes, menus, and the like. This suits my purpose.

Having progressed this, my challenge was to produce a grid based on simple Windows and using simple code in LB to get over the problem. I have also thought about developing a dll. It is early days yet, but it it's coming along. At the moment I can produce a flexible grid using LB. I am now working on how to extract and manipulate data entered into the grid and producing the functions to do so. All it is, is a challenge, which to me is what coding is all about.

What would I use by choice. LBB. It is simple and, unlike LB, the code is simple and concise, but just producing a grid is no longer a challenge and I have moved on from that.

I shall continue with my challenge with LB until it is either completed or I can't progress it further. In my retirement I have the time. The question is do I have the expertise?

Ray.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Grid of Textboxes using Windows API
« Reply #7 on: Jul 23rd, 2016, 09:59am »

on Jul 23rd, 2016, 09:05am, RNBW wrote:
You misunderstand my reasons for investigating using the Windows API... my challenge was to produce a grid based on simple Windows and using simple code in LB to get over the problem.

Having designed LBB to overcome the problem of creating controls in a loop, there is a degree of frustration in seeing workarounds still being developed for LB (and then having them posted in this forum because they don't work in LBB!).

If LB was more competently implemented I could understand why people might not want to 'burn their boats' by committing to LBB. But really LB (4.04, and even more so 4.5.0) is awful! The slowness, the bloat, the bugs, the incompatibility with DEP, the insecurity - for me these and other shortcomings far outweigh loyalty to Carl Gundel (which I don't think he deserves anyway).

Richard.
User IP Logged

RNBW
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 106
xx Re: Grid of Textboxes using Windows API
« Reply #8 on: Jul 23rd, 2016, 11:55am »

on Jul 23rd, 2016, 09:59am, Richard Russell wrote:
Having designed LBB to overcome the problem of creating controls in a loop, there is a degree of frustration in seeing workarounds still being developed for LB (and then having them posted in this forum because they don't work in LBB!).

If LB was more competently implemented I could understand why people might not want to 'burn their boats' by committing to LBB. But really LB (4.04, and even more so 4.5.0) is awful! The slowness, the bloat, the bugs, the incompatibility with DEP, the insecurity - for me these and other shortcomings far outweigh loyalty to Carl Gundel (which I don't think he deserves anyway).

Richard.


Richard

The reason I did what I did was because I saw code produced by Cundo on a grid of textboxes, which whilst it did the job, produced what I considered a more complicated way off achieving the result. Because I normally work with LBB, I tried the code on LBB and it didn't work. I their posted the code on LBB and you corrected it. Your corrections were very much on lines I had tried earlier but showed up errors in LB. Having previously posted the code on LB (which strangely did work), I felt it only right to post correct code.

I have been working for several weeks on Freebasic, helping the author of WinGUI.bi (a Windows API library that can only be used for simple code - we know there are things not technically correct). Having gained this knowledge, I wanted to see if I could use it to get over some of LB's problems. You did it with LBB. Surely I should be able to do it for a particular problem also.

I am progressing it slowly. It might work. It might not.

I don't intend to use it on a permanent basis. I use LBB and see no reason to revert to LB, which doesn't provide me with the solutions I want. I will continue to use LBB, which is superior to LB in most respects. In particular, it is supported by BBC Basic that is known to be stable and more powerful than LB. It is also relatively bug free and bugs are quickly resolved (these are few and far between).

As I said, it it's a challenge to me. As always I am grateful for the help you have provided. I know how you feel about LB and it's administrators (language and forum). You could always release a new language based on LBB and BBC Basic and I am aware of some of the reasons that you don't.

My actions are not intended to be critical of LBB, yourself and all others who support LBB.

Rant over. I'm going back to watching the cricket. Woakes has just lost his wicket caught and bowled for 58.

LBB for ever!

Ray
User IP Logged

CryptoMan
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 46
xx Re: Grid of Textboxes using Windows API
« Reply #9 on: Aug 16th, 2016, 9:14pm »

This is a very nice grid.

However, in order make it more usable it should move to the next cell with a TAB or with ENTER key, and able to navigate with arrow keys.

How can we do this?

Earlier grid examples was able to do this.

I remember making a grid on LB very painfully. This looks quite elegant in coding.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Grid of Textboxes using Windows API
« Reply #10 on: Aug 16th, 2016, 11:39pm »

on Aug 16th, 2016, 9:14pm, CryptoMan wrote:
However, in order make it more usable it should move to the next cell with a TAB or with ENTER key, and able to navigate with arrow keys. How can we do this?

I would prefer not to discuss the LB-compatible approach here. LBB has a much easier way of creating grids of controls so can we please concentrate on that.

Richard.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Grid of Textboxes using Windows API
« Reply #11 on: Aug 17th, 2016, 8:42pm »

This code works to create grids of textboxes for one window, but I want to generalize, and use it for several windows.
But it seems that the actual window name is required in the three statements containing "tmp".
Is there any way around this?
r.m.

Code:

 call tbNumberCG "#cogs.tb", 6,185,40,10,60,25  
    .......    
    sub tbNumberCG x$,lmt,j,k,l,m,n      
    for x = 1 to lmt
      var$ = x$ + "0"+right$(str$(x),2)     
      textbox #cogs.tmp, j, (k*x)+l0, m, n     
      stylebits #cogs.tmp, _ES_NUMBER, 0, 0, 0
      maphandle #cogs.tmp, var$
    next x 
    end sub

 
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Grid of Textboxes using Windows API
« Reply #12 on: Aug 17th, 2016, 10:51pm »

on Aug 17th, 2016, 8:42pm, Alincon wrote:
But it seems that the actual window name is required in the three statements containing "tmp".
Is there any way around this?

In just the same way as you initially give your controls the same temporary name (later using maphandle to change them to the required names) you can initially give your multiple windows the same temporary name too! That should hopefully solve your problem, because now the window name you specify in your sub can be the same for all the windows. Something like this:

Code:
    call tbNumberCG "#cogs", 6,185,40,10,60,25  
    open "Window 1 (#cogs)" for window as #tmp
    maphandle #tmp, #cogs
    
    call tbNumberCG "#wheel", 6,185,40,10,60,25      
    open "Window 2 (#wheel)" for window as #tmp
    maphandle #tmp, #wheel
    
    #cogs.tb03 "Hello "
    #wheel.tb04 "world!"

    wait
    
    sub tbNumberCG x$,lmt,j,k,l,m,n      
    for x = 1 to lmt
      var$ = x$ + ".tb0" + right$(str$(x),2)     
      textbox #tmp.tmp, j, (k*x)+l0, m, n     
      stylebits #tmp.tmp, _ES_NUMBER, 0, 0, 0
      maphandle #tmp.tmp, var$
    next x 
    end sub 

Richard.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Grid of Textboxes using Windows API
« Reply #13 on: Aug 18th, 2016, 01:48am »

So the one maphandle statement takes care of several textboxes?
(the '6' in the call statement below is the count of textboxes)
r.m.

Code:
    call tbNumberCG "#cogs", 6,185,40,10,60,25  
    open "Window 1 (#cogs)" for window as #tmp
    maphandle #tmp, #cogs
 
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Grid of Textboxes using Windows API
« Reply #14 on: Aug 18th, 2016, 09:37am »

on Aug 18th, 2016, 01:48am, Alincon wrote:
So the one maphandle statement takes care of several textboxes?

No, in LBB each maphandle affects only one window or control. That's why maphandle is called 14 times in all in the code I listed (once for each textbox and once for each window).

Did you not run the code I listed? Unlike your snippet, mine was a complete self-contained program: I always prefer that complete programs be posted, rather than extracts that don't actually do anything in isolation.

Richard.
« Last Edit: Aug 18th, 2016, 09:49am by Richard Russell » User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Grid of Textboxes using Windows API
« Reply #15 on: Aug 18th, 2016, 2:21pm »

I meant to ask if only one maphandle statement was required for each window, after the maphandle statements for the individual controls for that window were done.
I think I've got it now.

r.m.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Grid of Textboxes using Windows API
« Reply #16 on: Aug 18th, 2016, 2:28pm »

I also wanted to show this code that creates either one or two rows of four textboxes
r.m.

Code:
    for x = 1 to 4 + (4 * (filStat = 2))   
      a$ = "0" + str$(x)       
      var$ = "#ssb.tb" + a$        
      textbox #ssb.tmp, 200 + (100 * (x > 4)), (30*x)+30 - (120 * (x > 4)), 60, 25          
      stylebits #ssb.tmp, _ES_NUMBER, 0, 0, 0
      maphandle #ssb.tmp, var$
    next x  
 
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Grid of Textboxes using Windows API
« Reply #17 on: Aug 18th, 2016, 2:54pm »

It appears that the 'window' maphandle command must occur before any other controls are created - is that right?

r.m.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Grid of Textboxes using Windows API
« Reply #18 on: Aug 18th, 2016, 4:21pm »

on Aug 18th, 2016, 2:54pm, Alincon wrote:
It appears that the 'window' maphandle command must occur before any other controls are created - is that right?

The 'window' MAPHANDLE must come after the OPEN, whereas all the controls for that window must be created before the OPEN (this is the case in LB and LBB); so I'm not really following what you mean. If by "other" controls you mean controls which aren't shared between multiple windows, here's an example (I've added a checkbox to window 2):

Code:
    call tbNumberCG "#cogs", 6,185,40,10,60,25 
    open "Window 1 (#cogs)" for window as #tmp
    maphandle #tmp, #cogs
    
    call tbNumberCG "#wheel", 6,185,40,10,60,25      
    checkbox #tmp.cb, "Checkbox", [], [], 185, 275, 100, 25 
    open "Window 2 (#wheel)" for window as #tmp
    maphandle #tmp.cb, #wheel.cb
    maphandle #tmp, #wheel
    
    #cogs.tb03 "Hello "
    #wheel.tb04 "world!"
    #wheel.cb "set"

    wait
    
    sub tbNumberCG x$,lmt,j,k,l,m,n      
    for x = 1 to lmt
      var$ = x$ + ".tb0" + right$(str$(x),2)     
      textbox #tmp.tmp, j, (k*x)+l0, m, n     
      stylebits #tmp.tmp, _ES_NUMBER, 0, 0, 0
      maphandle #tmp.tmp, var$
    next x 
    end sub 

Richard.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: Grid of Textboxes using Windows API
« Reply #19 on: Aug 18th, 2016, 11:41pm »

The 'window' maphandle must be AFTER the window is open! That's what I missed. Thanks.

r.m.













User IP Logged

Pages: 1 2 3  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls