Jump to content

UniListBox OnClick event handler


Guest Efthymios Kalyviotis

Recommended Posts

Guest Efthymios Kalyviotis

Hello,

 

first of all, I must congratulate all of the persons that are working on this exciting project.

I have a couple of small questions.

 

1) When I add a TUniListBox on a TUniForm and assign its onClick event handler, I observe the following strange thing:

Opening the application inside the WebBrowser and clicking an item on the list box, the event is being called twice. Why is that happening?

Is it possible that something conflicts with the application that runs on the desktop?

 

2) I do populate a uniListBox with a procedure like the following inside an other (master) UniListBox onClick event:

 

SubDevsUniListBox.Clear;

DevsNum:= JSON['result'].AsObject['totalDevicesReturned'].AsInteger;

for i := 0 to DevsNum - 1 do

begin

item:= JSON['result'].AsObject['devices'].AsArray.O;

SubDevsUniListBox.Items.Add(item['key'].AsString);

end;

 

uniTimer.Enabled:= True;

 

In my timer event, I do something like the following inside it:

 

for i := 0 to SubDevsUniListBox.Count - 1 do

sDevs:= sDevs + '{"key": "' + SubDevsUniListBox.Items + '", "channels": "null"},';

 

The problem is that the SubDevsUniListBox that is populated before the timer gets enabled, contains in its count property a value like 2543345 which is imposible. What might be happening and how can I solve it? Is it possible that the error occurs because my masters onClick event handler is called by the system twice?

 

3) It would be a nice idea if we had a way to implement somehow our own custom UniSomething components. Perhaps in other versions we might get a framework for that?

 

Thank you very much.

 

Yours sincerely,

Efthymios Kalyviotis.

Link to comment
Share on other sites

Use uniStringGrid instead of ListBox, way more functionality - columns, stripes coloring, custom draw handler, RefreshRow method etc. I tried ListBoxes earlier, but they feel "unreliable", so I replaced them with stringgrids, and after recent minor bugfixing they are simply brilliant.

Link to comment
Share on other sites

  • Administrators

1) When I add a TUniListBox on a TUniForm and assign its onClick event handler, I observe the following strange thing:

Opening the application inside the WebBrowser and clicking an item on the list box, the event is being called twice. Why is that happening?

Is it possible that something conflicts with the application that runs on the desktop?

 

2) I do populate a uniListBox with a procedure like the following inside an other (master) UniListBox onClick event:

 

SubDevsUniListBox.Clear;

DevsNum:= JSON['result'].AsObject['totalDevicesReturned'].AsInteger;

for i := 0 to DevsNum - 1 do

begin

item:= JSON['result'].AsObject['devices'].AsArray.O;

SubDevsUniListBox.Items.Add(item['key'].AsString);

end;

 

uniTimer.Enabled:= True;

 

In my timer event, I do something like the following inside it:

 

for i := 0 to SubDevsUniListBox.Count - 1 do

sDevs:= sDevs + '{"key": "' + SubDevsUniListBox.Items + '", "channels": "null"},';

 

The problem is that the SubDevsUniListBox that is populated before the timer gets enabled, contains in its count property a value like 2543345 which is imposible. What might be happening and how can I solve it? Is it possible that the error occurs because my masters onClick event handler is called by the system twice?

 

3) It would be a nice idea if we had a way to implement somehow our own custom UniSomething components. Perhaps in other versions we might get a framework for that?

 

Hello,

 

1 & 2 : First of all are you using the latest build of uniGUI which is 0.85.0.873? If yes can you send a test case which can reproduce above issues?

 

3: Yes, certainly that will be possible.

Link to comment
Share on other sites

Guest Efthymios Kalyviotis

Hello,

 

1 & 2 : First of all are you using the latest build of uniGUI which is 0.85.0.873? If yes can you send a test case which can reproduce above issues?

 

3: Yes, certainly that will be possible.

 

Dear Farshad,

 

I am using the uniGUI Beta v0.84.5.836 (8.70 MB 2011-03-21).

 

I tried to reproduce both of my problems in a small application created (I attached it).

 

For the 1st. The click event is called twice (in the browser) only when I have a breakpoint inside the onclick event of the list box.

For the 2nd. Clicking one item inside the 1st list box will see the problem.

 

The rar has both the source code and executable.

 

Thank you very much.

UniGuiLBClick.rar

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...