, ,

Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

ListBox & LBCheck Bitmap (OpenInsight 32-Bit)

At 10 DEC 2002 11:32:25PM Deirdre Affleck wrote:

Has anyone ever used the toggle on/off with lbcheck in a list box where it has more than one level, ie. hierarchical

I duplicated lbcheck and called it lbcheck4 with 4 images (a little colour co-ordination for levels on/off), but when I click on the second level to toggle on/off, the first level box is displayed beside the second level box, until the position is changed then it displays perfectly.

Also the "UPDATE" of send_message appears to be returing a 2-2 rather than the expected 3-2.

Thanks in advance

Deirdre Affleck


At 11 DEC 2002 04:24AM Oystein Reigem wrote:

Deirdre,

You might have to supply more details.

By searching my system I found out that lbcheck is a bmp in the BMPS folder with two images - a ticked square and a non-ticked one. I gather it's used when you need check boxes in your list boxes.

But what exactly is it you try to do now?

- What exactly are the 4 images of your lbcheck4 for?

- You say your list box is hierarchical but how do you want your images placed?

- - One image per item?

- - Flush with the left margin or following the indentation of the text?

- What exactly is the content of your list box?

- What programming (event handlers) have you got for your list box?

- Where did you get the programming from?

I can try to duplicate your results if you tell me more.

- Oystein -


At 11 DEC 2002 05:38PM Deirdre Affleck wrote:

Oystein,

In the KnowledgeBase there is an article & zip under Functions/subroutines/Programming called List box with Check boxes.

This is an example of a single level list box the on/off check is always on the first level ie 1-1, 2-1 (for the images).

What I want is to use the same concept on a second level (3-2, and 4-2 for the images) ie level one is a category and underneath are all the sub categories for the category.

It works fine except on the second level when the check box is toggled between the checked/unchecked image, both first and second level images are displayed, until such time as the cursor/mouse is moved and then it displays correctly.

I have included the code for the changed and char event for the list box.

this was the code from the knowledge base, amended for a second level in the list box

changed event declare function Send_Message declare subroutine Send_Message if @CtrlEntID-]Misc else * toggle the checkbox bitmap Pos =@CtrlEntID-]SelPos Pic =Send_Message(CtrlEntID, "UPDATE", Pos, "") Level=Pic3,1 If Level=' then Level=1 OnOff=Pic1,1 If OnOff=1 then OnOff=2 End Else OnOff=1 End level remain the same, on off to toggle

Pic=OnOff:" - ":Level
Send_Message(CtrlEntID, "UPDATE", Pos, Pic)

end

RETURN 0

** Char event

declare subroutine Send_Event, Yield

$insert Logical

if VirtCode=char(32) then

  • space means toggle
Send_Event(CtrlEntID, "CHANGED")

end else

  • because whatever caused the CHAR event can cause the CHANGED event
  • as well, set the MISC property to show the CHANGED event that it
  • is being triggered by character input (instead of by a click)
@CtrlEntID-]Misc=TRUE$     ;* flag that the CHAR event is being processed
Yield()                      ;* allow CHANGED event to process
@CtrlEntID-]Misc=FALSE$    ;* CHAR event is done being processed

end

RETURN 0

Regards

Deirdre


At 12 DEC 2002 04:07AM Oystein Reigem wrote:

Deirdre,

More questions might need to be answered.

You say your list box is hierarchical, with two levels. What does that really mean?

(Q1)

Do you just want to display a static list of items where some items are on level 1 and some on level 2?:

  Cats
      Burmese
      Siamese
  Dogs
      Alsatians
      Poodles

(Q2)

Or do you also want to collapse and expand nodes? Like doubleclicking the Cats node hides the subordinate Burmese and Siamese nodes?:

  Cats
  Dogs
      Alsatians
      Poodles

(Q3)

Furthermore: Should checking a node on one level affect the other level? E.g, isn't it logical that ticking the Cats automatically should make the subordinate Burmese and Siamese nodes ticked too?:

X Cats
    X Burmese
    X Siamese

Then you need more programming.

Also you might need tri-state checkboxes for your first level. E.g, if you now untick Siamese so Burmese is ticked but not Siamese, the mother node Cats should have an intermediate "partly ticked" state.

(Btw - I can think of other possible ways of solving this problem than tri-state boxes.)

(Q4)

Do you even need your app to be able to change the content of the list on the fly? Then you might need more programming too.

(Q5)

But even if we forget advanced features like the ones I mention in (Q3) and (Q4) I have a question about the checkbox images. You say you have four images in total, but do you really need different images for the two levels? You haven't given me any reason to believe so.

Actually your version of the CHANGED handler still operates with two images. I ran the CHECKLIST window with your version of the CHANGED handler and the old two-image LBCHECK.BMP. And everything looked just fine to me. I can't see the artefacts you see.

Your checkbox images not displaying correctly

You say It works fine except on the second level when the check box is toggled between the checked/unchecked image, both first and second level images are displayed, until such time as the cursor/mouse is moved and then it displays correctly. Would you be able to do a screen dump that shows the problem? Do Alt+PrintScreen, paste the result into a mail, or a Word document, and mail to me at both and . Or include it in your posting here if you have the means and knowledge of how to do it.

You might get two images at a time if there is a discrepancy between the number of the images in your file (4) and the number you've set in the Number of Images property (2), but then you would see two images all the time.

(Q6)

Back to the number of images. Perhaps what you're trying to tell is that you need two sets of images - one set of two images telling if the item is ticked or not, and another set of two images telling the level of the item:

X A Cats
    X B Burmese
      B Siamese
  A Dogs
      B Alsatians
    X B Poodles

Is that it?

- Oystein -


At 12 DEC 2002 04:20AM Oystein Reigem wrote:

Deirdre,

I was able to duplicate your display problem. It happened after I ticked Hierarchical in the list box.

You might think me stupid for not ticking Hierarchical earlier. But it's not obvious you need it ticked. If you don't need collapsing and expanding (my Q1) just leave it unticked.

You might also leave it unticked if you want full control over collapsing and expanding and need to handle everything programmatically. (At least I think so. I've done very convoluted stuff with hierarchical list boxes, but must confess I don't remember how I had my Hierarchical setting. And I won't investigate until I (you) need to know.)

But I got another problem after I ticked Hierarchical - I think when I tried to collapse a level 1 node. The system crashed with the "OpenInsight has generated errors and will be closed by Windows…" message. Did you ever get that when experimenting with your hierarchical list box window?

- Oystein -


At 12 DEC 2002 05:03AM Oystein Reigem wrote:

Deirdre,

The problem seems to be this little bugger in the CHANGED handler:

[i]Pic=Send_Message(CtrlEntID, "UPDATE", Pos, "")[/i]

It's used to get the image and level information for the current line. But it also sets the image and level information, to a value of "", which probably is interpreted as "1-1".

Try the following instead:

/* get the whole content of the list box
   (the LIST property) -
   the visible content to be precise
   (some of the content might be collapsed and invisible).
   then extract the current item.
   from that extract the image and level information (Pic).
   (the TEXT property also contains the the current item,
   but just the text - not the image and level information */
List  =Get_Property( CtrlEntID, "LIST" )
SelPos=Get_Property( CtrlEntID, "SELPOS" )
Curr_Item=List
Pic=Curr_Item1, ":"

However - now that I got a check box equipped collapsable/expandable list with to work I see there is a problem with the level 1 boxes. When you doubleclick a level 1 node to collapse or expand it you change the ticked state too.

I might help you with that too once you've thought through what ticking on level 1 really means.

Btw - if you tick the "Enter=dbl click" property you can collapse and expand with the Enter key, without any undesired effect of doubleclicking.

- Oystein -

View this thread on the Works forum...