Android Tutorial Guess my number - Visual designer & Events

n8ptg

New Member
Licensed User
Longtime User
How to delete a control?

Sorry to ask a newbie question, but how do you delete a control in Designer? The delete key does not work in the emulator. In Designer, right clicking will bring up a Delete option but it only seems to delete the text in the control selector drop-down selector.

Also, what does "Generate Members" do in the Designer?
 

CharlesR

Member
Licensed User
Longtime User
I am sorry to be a newbie but I have just downloaded B4A and am very impressed. I ran tutorial 1 fine, but now on Tutorial2 I get
"Compiling code. Error
Could not find file 'C:\Users\Charles\AppData\Local\Temp\Temp1_GuessMyNumber.zip\Guess My Number\Files\layout1.bal'.
What directory structure do you recommend and how do I configure that. Thanks
 

DazRacing

Member
Licensed User
Longtime User
Text colour...?

Hi,

Just purchased B4A and having a go with this Guess example, so go easy please

When I add a button via Add View > Button and it appears on the emulator it's text appears in grey and not black as per your example OR as per the Text Color of my properties window... I'm confused?

I can't see any option to change this? The option that is Text Style > Text Color already states it's "Black", but it's not showing as Black in the emulator.

What am I missing...? :sign0085:
 

cmartins

Member
Licensed User
Longtime User
Activity.LoadLayout

erel,

In the 1st post you sad:

"Android destroys the old activity and creates a new activity each time the orientation changes. Therefore Activity.LoadLayout will be called again each time. Unfortunately the number will also be randomly chosen again each time. This can be easily fixed... But not in this tutorial."


I need this information. It will be very useful.


thanks
 

ssolid

Member
Licensed User
Longtime User
help

How to use the keyword "ToString"?give me a exmple.

Did b4a have keyword like "End" of VB.So I can end my all project.
 

askncan

New Member
I think i made something extreamly wrong :sign0161:

B4X:
Sub Process_Globals
   
End Sub

Sub Globals
    Dim MyNumber As Int
    Dim EditText1 As EditText 
End Sub

Sub Activity_Create(FirstTime As Boolean)
     Msgbox ("Welcome to guess my number!","") 
    Activity.LoadLayout("Layout1")
    MyNumber = Rnd(1,73 100) 
End Sub



Sub Button1_Click
    If EditText1.Text > MyNumber Then
        ToastMessageShow("My number is smaller.", False)
    Else If EditText1.Text < MyNumber Then
        ToastMessageShow("My number is larger.", False)
    Else
        ToastMessageShow("Well done.", True)
    End If
    EditText1.SelectAll
End Sub

:sign0163: :sign0085:
 

askncan

New Member
oh, good how will that line look?

my error is that when i press the "Guess!" button it dosent happen anything
 

clusker2

Member
Licensed User
Longtime User
Pasding FirstTime state

I am working with B4A trial and really like! I am working through this Guess My Number tutorial and added some of my own stuff to start getting used to it. The game works great the first time through. However, I think I am not correctly passing the "FirstTime" state back to Activity_Create Sub as it is going directly to the Else part of the statement, then errors out on the second time around after making my first guess. Can someone suggest any changes to get me past this? I am not much of a programmer... more of a hacker, so please be gentle! This is my first post, and I added my project via a .zip... I think. Thanks!
 

Attachments

  • GMN.zip
    8 KB · Views: 379

clusker2

Member
Licensed User
Longtime User
It works

Thanks Erel! I did go over the tutorial and also created a sub called "Reset" as you suggested and it worked perfectly! I appreciate the support!
 

DavidRGreen

New Member
Licensed User
Longtime User
Orientation variant issue

Day 1, starting with the tutorials, and I have been looking over the steps repeatedly, looking for something missed and cannot see it.

When attempting to create a variant for landscape, using ctrl+F11 rotates both the emulator skin but also the window within.

With the emulator skin controls (buttons) are oriented horizontally in landscape (as expected), but the emulator viewport is rotated as well, so the labels, input and button are sideways as well (left to right becomes bottom to top). The viewport also includes the notification bar which is also rotated 90° CCW.

Even the sample for download displays the same way.

Any suggestions as to what could possibly be going wrong here would be appreciated.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…