Dynamic Poptrigger two ways

zhaozj2021-02-16  58

I will summarize it, and the dynamic poptrigger has two ways:

One is to associate using poplist and List, the association method is PopTrigger <=> Poplist <=> List, which generated PopTrigger does not use the LSTSETDRAWFunction to set the callback function to dynamically add, you must use LSTSETLISTCHOICES, because the callback function is only responsible, The structural variables of the List are not set, so the PopTrigger after the association will cause access to the conflict due to the structural variables that are not set. This method is because automatic associations, naturally related between List, and PopTrigger, there is no need to make additional programming, the disadvantage is that dynamic adding and deleting is more troublesome, because LstsetListchoices need a char **.

The other is to respond to Poplist's CTLSELECTEVENT events, pop up with listpopuplist (). In this way, you can use the LSTSETDRAWFunction to set the callback function to dynamically add or use LSTSETLISTCHOICES. The advantage is that you can use the callback function, add flexibility, you can implement the effect of LSTSETLISTCHOICES, but the disadvantage is that it is not completely associated at all, so Add some programming work.

Special attention when using the callback function function, because the callback function is actually only painted, so the structure variable of the List does not exist. If you want to use the function of LstgetSelectionText, it will only cause access Violate.

Summary, Palm's memory management is also relatively fragile. Once the memory leaks will even make the entire system problems. Let me prevent memory leaks, let's prevent the operation of the empty pointer!

转载请注明原文地址:https://www.9cbs.com/read-19225.html

New Post(0)