It is currently Sat Apr 29, 2017 10:28 am



Welcome
Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!


Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Starting first serious project...a few questions...
Unread postPosted: Tue Mar 28, 2017 5:07 pm 
Offline

Joined: Tue Apr 23, 2013 1:54 am
Posts: 36
@RSA

Many thanks for putting time/effort in to this but just looking at your screen grab, I cannot bring myself to accept this code redundancy.
For the sake of one parameter difference you have separate calls to GR.MODIFY and WAITTOUCHUP. I would use a state machine to evaluate the touch x/y
and have only a single call to the above.

Respectfully,

Tinine


Report this post
Top
 Profile  
 
 Post subject: Re: Starting first serious project...a few questions...
Unread postPosted: Tue Mar 28, 2017 9:31 pm 
Offline
User avatar

Joined: Sat Oct 04, 2014 5:45 am
Posts: 628
Tinine wrote:
For the sake of one parameter difference you have separate calls to GR.MODIFY and WAITTOUCHUP

With respect Tinine,
You have not downloaded the source code or tested the APK as of
your writing as the link indicates and you are completely making the wrong assumption.
The only other option you have in graphics is to first learn some more Basic to get more compacted code.
Thus I suggest you use Gregor's excellent advice.
The purpose of RFODESIGNER is to rapidly in minutes develop a GUI for an application by even a novice.
What I attached was all done in exactly less than 3 minutes including generating the APK.
No pain = No gain
I refer you to rfo-designer-quick-question-t4882.html

Just to put things in perspective for the sake of other users and readers.
The screenshot is only showing the SUBROUTINE and is meaning that :
- WAITTOUCHUP can be omitted but is convenient to have as an option on touch response.
- This is not a touch routine. This is not where the touch is evaluated.
- This is the SUBROUTINE where the user inserts his own code that he wants to be executed when touching that specific region. Same like VB
- RFODESIGNER only generates a SUBROUTINE when asked to do so.
- Also the user could at any time check the variable "Owner$" to see who was touched last.

Below the optional SUBROUTINES for the touch regions as per my previous post:
Code:
ONCLICK_TchRect1:
   ! Your code todo
   GR.MODIFY Screen1[TxtBtn1], "text", "ONE"
   GoSub WAITTOUCHUP
RETURN

ONCLICK_TchRect2:
   ! Your code todo
   GR.MODIFY Screen1[TxtBtn1], "text", "TWO"
   GoSub WAITTOUCHUP
RETURN

_________________
Download and tutorial for RFODESIGNER
https://sites.google.com/site/rfodesigner/


Report this post
Top
 Profile  
 
 Post subject: Re: Starting first serious project...a few questions...
Unread postPosted: Wed Mar 29, 2017 1:52 am 
Offline

Joined: Tue Apr 23, 2013 1:54 am
Posts: 36
RSA wrote:
The only other option you have in graphics is to first learn some more Basic to get more compacted code.
Thus I suggest you use Gregor's excellent advice.


Oh, I have been creating touch-screen GUIs for 33 years. Back then, when I discovered the MicroTouch (now 3M)
capacitive technology (1024 X 1024 res), most people had never heard of such things.
Those were FUN times because I was determined to have the best possible GUI but the PC didn't have the horsepower for what I wanted, so, I pre-painted my backgrounds and 3D buttons, etc. and stored them in a RAM disk (upper 384K). They were still a bit slow to load but they loaded with a horizontal scrolling effect that actually looked like it was intentional. Fellow programmers were baffled by this achievement (didn't tell them about the painted graphics) and I was proclaimed a programming "genius"....so I cheated :lol:

My platform was the original PC (4.77MHz, 640K RAM) and the DOS, mouse-emulating driver really sucked so I wrote my own handler. I have always been obsessed with creating the most efficient code.

Yeah Gregor reminded me that, when I dabbled with BASIC!'s graphics, a few years ago, I soon discovered the need for Gr.modify... :lol:


Report this post
Top
 Profile  
 
 Post subject: Re: Starting first serious project...a few questions...
Unread postPosted: Wed Mar 29, 2017 2:50 am 
Offline

Joined: Tue Apr 23, 2013 1:54 am
Posts: 36
@RSA Here is another example: "If Ft = 0 & ScreenIndex = 1" is evaluated FIVE times when one time would be sufficient.

Code:
GETOWNER:
   GR.MODIFY Ftch, "x", nx, "y", ny
   Owner$ = ""  % Last Obj 1st to preserve Z-order
   Ft = 0
   GoSub CUSTOMOWNER
   If Ft = 0 & ScreenIndex = 1 & GR_COLLISION(Ftch, Screen1[7]) Then
      Owner$ = "TchRect3"
      GoSub ONCLICK_TchRect3
      Ft = 1
   End If
   If Ft = 0 & ScreenIndex = 1 & GR_COLLISION(Ftch, Screen1[6]) Then
      Owner$ = "TchRect2"
      GoSub ONCLICK_TchRect2
      Ft = 1
   End If
   If Ft = 0 & ScreenIndex = 1 & GR_COLLISION(Ftch, Screen1[5]) Then
      Owner$ = "TchRect1"
      GoSub ONCLICK_TchRect1
      Ft = 1
   End If
   If Ft = 0 & ScreenIndex = 1 & GR_COLLISION(Ftch, Screen1[2]) Then
      Owner$ = "Btn1"
      % GoSub ONCLICK_Btn1
      Ft = 1
   End If
   If Ft = 0 & ScreenIndex = 1 & GR_COLLISION(Ftch, Screen1[1]) Then
      Owner$ = "Bitmap1"
      % GoSub ONCLICK_Bitmap1
      Ft = 1
   End If
RETURN   


Regards,

Tinine


Report this post
Top
 Profile  
 
 Post subject: Re: Starting first serious project...a few questions...
Unread postPosted: Wed Mar 29, 2017 4:58 am 
Offline
User avatar

Joined: Sat Oct 04, 2014 5:45 am
Posts: 628
Tinine wrote:
Oh, I have been creating touch-screen GUIs for 33 years ......................
But then you should be telling us how to program graphics in Basic! instead of asking. 8-)
Tinine wrote:
Here is another example: "If Ft = 0 & ScreenIndex = 1" is evaluated FIVE times when one time would be sufficient

Two times is sufficient if I wrote all of it by myself and even more times if there was more SCREENS used :lol: but but but ..... you can
use OnGrtouch instead and see how much you can score ... by using Brochi's famous timer.
Or even better is to create a competitor application for RFODESIGNER so as to sport your generated code.

Yeah its obvious you did not read the link where I gave Cavelamb a very wide explanation of why.
It is clear you do not understand why it is like that ?
And just to keep in mind the loop would exit without evaluating further when Ft = 1 and also skip for when ScreenIndex <> 1
because only one SCREEN was used.
From this you can construe that in this framework you can have as many virtual SCREENS for display as your device can handle
because of memory. And the programmer did not write one word of it and the app is still fast and responsive and not ignoring
the so called "interrupts" in Basic.
I do not do slow and out of memory apps. ;)

Regards
Emile

_________________
Download and tutorial for RFODESIGNER
https://sites.google.com/site/rfodesigner/


Report this post
Top
 Profile  
 
 Post subject: Re: Starting first serious project...a few questions...
Unread postPosted: Wed Mar 29, 2017 5:20 am 
Offline

Joined: Tue Apr 23, 2013 1:54 am
Posts: 36
Tinine wrote:
I have been dabbling with BASIC! for several years and generally keeping an eye on the forum but never used it for anything more than quickie Bluetooth experiments.

Now I have decided to use BASIC! for a tablet-based GUI for my microcontroller-based project.

I prefer to create my GUI elements in a graphics package, as they can be much sexier than trying to draw them with code.
The method that I am currently experimenting with is to load a bunch of .png images, draw them and then hide the ones I don't yet want just prior to rendering. Then I just hide/show the images as needed.

1) Is this a safe/recommended practice or should I be expecting a problem with memory?
2) The .png files are currently loaded from a directory. When I get around to creating an .apk, can the bitmaps be incorporated, somehow?

Opinion: I have been using B4A for the past five years and I like it very much but as my apps are pretty much glitzy GUIs, I find that BASIC! is more than capable and MUCH faster to develop with. Many thanks to the developers of BASIC! and the 3rd-party tools. I shall be hitting the "Donate" buttons without hesitation. I just wish Marc had one.

Regards,

Tinine



@RSA Where exactly am I asking about "graphics programming"? It was about BASIC!'s memory management.

Don't get me wrong, I really am impressed with RFODESIGNER and actually cancelled a customer appointment today, just to get familiar with it. Trying to build an APK right now.
What I am thinking about is having the designer create the prototype and I will hand-code the bits that I don't like. I know that the end-user would never know the difference but I will :lol:


Report this post
Top
 Profile  
 
 Post subject: Re: Starting first serious project...a few questions...
Unread postPosted: Wed Mar 29, 2017 7:27 am 
Offline
User avatar

Joined: Sat Oct 04, 2014 5:45 am
Posts: 628
Tinine wrote:
What I am thinking about is having the designer create the prototype and I will hand-code the bits that I don't like.

Yes that's the spirit 8-) :D

Ps: Somewhere you mentioned the scale to the device that you are not worried about.
I suggest you do worry about it. It is no big deal. The "Design Size" can be anything.
RFODESIGNER takes care of it. The problem comes though when displaying a full screen bitmap
that would be scaled up to suite your tablet with a resulting "lost resolution"
Of course you would then also have "missing lines/pixels" in a scaled down version.
I suggest using the smallest design size that still produce acceptable quality.
And of course the aspect ratio of your tablet should be respected.

Strongs with the Pipe Bender 8-)
Emile

_________________
Download and tutorial for RFODESIGNER
https://sites.google.com/site/rfodesigner/


Report this post
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
suspicion-preferred