Hi Folk, well I''m now writing and app (to manage snort sensors and rulefiles ) and have am now trying to figure out which is the best widget for the job. Snort rule files have one rule per line, I want to display the rule file in a frame and allow the user to select individual rules by clicking on them. I may also want to select portions of a rule. Currently I''m using FXText but I find the FXEvent returns pixel (?) coordinates but all the FXText methods take a single ''pos'' parameter which presumably is the index from the start of the buffer. Clearly there must be a straight forward way to may between the two but I can''t figure it out. May be I''d be better off using some other widget but I can''t see one. Cheers, Russell
Russell Fulton wrote:> Hi Folk, > well I''m now writing and app (to manage snort sensors and rulefiles ) > and have am now trying to figure out which is the best widget for the job. > > Snort rule files have one rule per line, I want to display the rule file > in a frame and allow the user to select individual rules by clicking on > them. I may also want to select portions of a rule. > > Currently I''m using FXText but I find the FXEvent returns pixel (?) > coordinates but all the FXText methods take a single ''pos'' parameter > which presumably is the index from the start of the buffer. Clearly > there must be a straight forward way to may between the two but I can''t > figure it out. > > May be I''d be better off using some other widget but I can''t see one.What about an FXList, one entry per line of the file? That doesn''t help with selecting "portions"... are these portions syntactic chunks or arbitrary substrings? If the former, maybe a tree list would work (following the parse tree). -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
Thanks for your ideas Joel. Joel VanderWerf wrote:> >> >> May be I''d be better off using some other widget but I can''t see one. > > What about an FXList, one entry per line of the file?I had thought about that and may give it a try it was not my first choice because of the inability to do selections within the rule.> > That doesn''t help with selecting "portions"... are these portions > syntactic chunks or arbitrary substrings? If the former, maybe a tree > list would work (following the parse tree).mostly the former, I had *not* thought of parsing the rule and representing it as a tree. I''m using the tree widget in another panel to navigate the sensors and rule files. Russell.
On Dec 18, 2005, at 6:00 PM, Russell Fulton wrote:> Currently I''m using FXText but I find the FXEvent returns pixel (?) > coordinates but all the FXText methods take a single ''pos'' parameter > which presumably is the index from the start of the buffer. Clearly > there must be a straight forward way to may between the two but I can''t > figure it out.Have you tried the getPosAt() method, which should return the text position for a given (x, y) location in the visible area of the text widget?