This is what I am doing: For i = 1 To 3 name = "b"&CStr(i) AddObject "CommandButton",name,12+(55-12)*(i-1),80,36,32 Execute(name & ".Caption = " & CStr(i)) Next
For i = 1 To 3 name = "b"&CStr(i) Code = "Sub " & name & "_Click" & vbCrLf & name & ".Backcolor = &hC0C0C0" & vbCrLf & "b1.Text = " & Chr(34) & i & Chr(34) & vbCrLf & "End Sub" Execute(Code) Next >George > >The >Sub b1_click > b1.Backcolor = &H00C0C0C0& > TextBox1.Text = "10" 'for testing >End Sub > >The above works (for the hardcoded buttons), and color changes on the >button when b1 is pressed and also the TextBox1.Text updates BUT even >though buttons b2 to b7 'show' they are pressed, the TextBox1.Text does >not update and the color does not change, (I did remove the end &). >also the rpncalc example does not work? > >Martin > >--- In [email protected], "George Henne" <g...@...> wrote: >> >> The problem is the color - it worked when I changed the color from >> &H00C0C0C0& to &H00C0C0C0. >> >> >I tried to create 7 buttons and event code 'on the fly' as in TN34. >> >I'm using the CE version 7 of NS Basic. >> > >> >The buttons are drawn on the screen and 'graphicaly' click, but the >> >event does not trigger. >> > >> >I then hardcoded an event for 2 of the buttons and it worked. >> > >> >I tried the rpncalc example, and saw that the numeric buttons dont work >> >either. >> > >> >Has anyone got this working? >> > >> >the code is below >> > >> >(this works) >> >For i = 1 To 7 >> > name = "b"&CStr(i) >> > AddObject "CommandButton",name,12+(55-12)*(i-1),80,36,32 >> > Execute(name & ".Caption = " & CStr(i)) >> >Next >> > >> >(this does not work) >> >For i = 1 To 7 >> > name = "b"&CStr(i) >> > Code = "Sub " & name & "_Click" & vbCrLf & name & ".Backcolor = >> >&H00C0C0C0&" & vbCrLf & "TextBox1.Text = " & Chr(34) & i & Chr(34) & >> >vbCrLf & "End Sub" >> > Execute(Code) >> >Next >> > >> >(using this does work) >> >Sub b1_click >> > b1.Backcolor = &H00C0C0C0& >> > TextBox1.Text = "10" 'for testing >> >End Sub >> > >> >Thanks >> >Martin >> > >> > >> > >> >------------------------------------ >> > >> >Yahoo! Groups Links >> > >> > >> > >> > > > > >------------------------------------ > >Yahoo! Groups Links > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nsb-ce" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nsb-ce?hl=en -~----------~----~----~----~------~----~------~--~---
