hi there,
i am a php progger and new to b4a - and even new to visual basic in general. please dont bash me for stupid questions
i try to learn by modifying codes from others.
my problem since yesterday (and i am sure, its a simple stupid easy *****!) is, that b4a seems not to notify my button-clicks in a customdialog2 - box from andrew graham´s great dialog-lib.
here ist the code from his original-example, found in libery-zip:
here ist what i changed it to:
as in the sample, bmp is dimmed in process_globals. dialog-lib ist loaded. the Langu-Var is dimmed as char in process_globals.
the two buttons langbtn seem not to trigger langbtn_click - subs (1 and 2) when clicked. and i have no idea why. i am sure it is something easy and beginners-like-error - but i dont find it.
thank you!
i am a php progger and new to b4a - and even new to visual basic in general. please dont bash me for stupid questions
i try to learn by modifying codes from others.
my problem since yesterday (and i am sure, its a simple stupid easy *****!) is, that b4a seems not to notify my button-clicks in a customdialog2 - box from andrew graham´s great dialog-lib.
here ist the code from his original-example, found in libery-zip:
B4X:
Sub btnCustom2_Click
Dim cd As CustomDialog2
Dim pnl As Panel
pnl.Initialize("pnl")
Dim bgnd As ColorDrawable
bgnd.Initialize(Colors.Cyan, 5dip)
pnl.Background = bgnd
Dim btn1 As Button
btn1.Initialize("btn1")
btn1.Text = "Press me"
pnl.AddView(btn1, 80dip, 50dip, 60dip, 60dip)
lbl1.Initialize("")
pnl.AddView(lbl1, 50dip, 120dip, 120dip, 60dip)
Dim lv As ListView
lv.Initialize("lv")
lv.AddTwoLinesAndBitmap("one", "one", Null)
lv.AddTwoLinesAndBitmap("two", "one", Null)
lv.AddTwoLinesAndBitmap("three", "one", Null)
pnl.AddView(lv, 300dip, 120dip, 120dip, 250dip)
cd.AddView(pnl, 77%x, 60%y) ' sizing relative to the screen size is probably best
ret = cd.Show("B4A Custom Dialog", "Yes", "No", "Maybe", Bmp)
ToastMessageShow(ret,True)
End Sub
Sub btn1_Click
lbl1.Text = "Pressed!"
lbl1.Color = Colors.Black
ToastMessageShow("Pressed!", False)
End Sub
here ist what i changed it to:
B4X:
Sub Sprache
Do While Langu=""
Dim cd As CustomDialog2
Dim pnl As Panel
pnl.Initialize("pnl")
Dim bgnd As ColorDrawable
bgnd.Initialize(Colors.White, 5dip)
pnl.Background = bgnd
Dim langbtn1 As Button
Dim langbtn2 As Button
langbtn1.Initialize("langbtn1")
langbtn2.Initialize("langbtn2")
langbtn1.Text = "Deutsch"
langbtn2.Text = "Englisch"
pnl.AddView(langbtn1, 25dip, 50dip, 90dip, 50dip)
pnl.AddView(langbtn2, 125dip, 50dip, 90dip, 50dip)
lbl1.Initialize("Bitte eine Sprache wählen. Please select language.")
pnl.AddView(lbl1, 80dip, 100dip, 120dip, 60dip)
cd.AddView(pnl, 77%x, 60%y) ' sizing relative to the screen size is probably best
ret = cd.Show("Sprache", "OK", "", "", BMP)
ToastMessageShow("Language is "&Langu,True)
Loop
End Sub
Sub langbtn1_Click
lbl1.Text = "Deutsch gewält"
lbl1.Color = Colors.Blue
ToastMessageShow("Ok", False)
Langu="D"
End Sub
Sub langbtn2_Click
lbl1.Text = "Englisch gewält"
lbl1.Color = Colors.Blue
ToastMessageShow("Ok", False)
Langu="E"
End Sub
as in the sample, bmp is dimmed in process_globals. dialog-lib ist loaded. the Langu-Var is dimmed as char in process_globals.
the two buttons langbtn seem not to trigger langbtn_click - subs (1 and 2) when clicked. and i have no idea why. i am sure it is something easy and beginners-like-error - but i dont find it.
thank you!