Nekochan Net

Official Chat Channel: #nekochan // irc.nekochan.net
It is currently Fri Jul 25, 2014 1:03 am

All times are UTC - 8 hours


Forum rules


Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Motif 2.1 Frame widget
Unread postPosted: Thu Mar 29, 2012 5:47 pm 
Offline
User avatar

Joined: Tue Jul 21, 2009 4:07 am
Posts: 516
Location: Shenzhen, P.R.C
hi guys! for the past days at last i started to work on my wishlist for my SGI, one is porting a software :)

my approach is a bit different from the usual hehe i started from scratch, its not so big anyway :) but for me, its very useful! i hope you like it as soon as i can release alpha version :)

so about my question, i got a weird behavior with one of my widget. Its a frame manager with only one child which is a label gadget. if i update the label to display a numeric value, the frame will shrink just enough for the child which is 1 or 2 characters wide. So what i did was hehe not so good idea, after updating the label gadget, i will re display the frame title which is longer than the child, then it worked :) but is there a better way than this? but still this i not the question. what happened is i developed motif in my winxp using cygwin then use nfs and xnest to try my code on my O2; in my cygwin, the child updates ok and still at the middle of the frame, but on my IRIX, it updates but the label becomes left aligned to the frame? hmm i already try to play around but still no use, that's why i came here for all motif gurus :) thanks in advance!

_________________
:Octane: (Sakura) :O2: (Sasuke) :1600SW: (Naruto) ... lil Jesse! (O2 laptop)
“Imagination is more important than knowledge.“ – A. Einstein


Top
 Profile  
 
Unread postPosted: Tue Apr 17, 2012 5:33 am 
Offline
User avatar

Joined: Tue Oct 12, 2004 2:54 pm
Posts: 286
Location: London, Ingerlund
Hiya Geo,

Perhaps if you post or attach some of your widget creation code we could help out more...

Jimmer.

_________________
:Fuel: redbox 800Mhz 4Gb V12


Top
 Profile  
 
Unread postPosted: Tue Apr 17, 2012 5:31 pm 
Offline
User avatar

Joined: Tue Jul 21, 2009 4:07 am
Posts: 516
Location: Shenzhen, P.R.C
hi jimmer! thanks for asking hehe the status is im almost done with alpha release but still this issue is in there so hehe really thanks for checking this

ok ill post the code here

this is the code for creating the affected widget
Code:
XtSetLanguageProc (NULL, NULL, NULL);
   *w_TopLevel = XtVaOpenApplication (xac_App, "gXipmsg", NULL, 0, &argc, argv, NULL,sessionShellWidgetClass, NULL);
   
   // Create paned window
   SENDFORM_Pane_Vertical = XmCreatePanedWindow (*w_TopLevel, "Vertical", NULL, 0);
   
   // Create upper form
   SENDFORM_Form_Upper = XmCreateForm (SENDFORM_Pane_Vertical, "Upper", NULL, 0);
   
   // Create frame
   SENDFORM_Index = 0;
   XtSetArg (SENDFORM_Args[SENDFORM_Index], XmNshadowType, XmSHADOW_ETCHED_OUT); SENDFORM_Index++;
   XtSetArg (SENDFORM_Args[SENDFORM_Index], XmNtopAttachment, XmATTACH_FORM); SENDFORM_Index++;
   XtSetArg (SENDFORM_Args[SENDFORM_Index], XmNrightAttachment, XmATTACH_FORM); SENDFORM_Index++;
   XtSetArg (SENDFORM_Args[SENDFORM_Index], XmNtopOffset, 5); SENDFORM_Index++;
   XtSetArg (SENDFORM_Args[SENDFORM_Index], XmNrightOffset, 5); SENDFORM_Index++;
   SENDFORM_Frame_Member = XmCreateFrame (SENDFORM_Form_Upper, "MemberFrame", SENDFORM_Args, SENDFORM_Index);
   
   // Create count label
   SENDFORM_Index = 0;
   XtSetArg (SENDFORM_Args[SENDFORM_Index], XmNchildType, XmFRAME_WORKAREA_CHILD); SENDFORM_Index++;
   XtSetArg (SENDFORM_Args[SENDFORM_Index], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); SENDFORM_Index++;
   SENDFORM_LblG_Count = XmCreateLabelGadget (SENDFORM_Frame_Member, "0", SENDFORM_Args, SENDFORM_Index);   
   XtManageChild (SENDFORM_LblG_Count);   
   
   // Create member label
   SENDFORM_Index = 0;
   XtSetArg (SENDFORM_Args[SENDFORM_Index], XmNchildType, XmFRAME_TITLE_CHILD); SENDFORM_Index++;
   XtSetArg (SENDFORM_Args[SENDFORM_Index], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); SENDFORM_Index++;
   SENDFORM_LblG_Member = XmCreateLabelGadget (SENDFORM_Frame_Member, "Member", SENDFORM_Args, SENDFORM_Index);   
   XtManageChild (SENDFORM_LblG_Member);   
   
   XtManageChild (SENDFORM_Frame_Member);




this function is to update the label count value
Code:
void sendForm_UpdateCount(int m_Count)
{
   char str_Dest[8];   
   XmString xstr_Dest;
   
   sprintf(str_Dest, "%i", m_Count);
         
   xstr_Dest = XmStringCreateLocalized (str_Dest);      
   XtVaSetValues (SENDFORM_LblG_Count, XmNlabelString, xstr_Dest, NULL);
   
   
   strcpy(str_Dest, "Member");
      
   xstr_Dest = XmStringCreateLocalized (str_Dest);   
   XtVaSetValues (SENDFORM_LblG_Member, XmNlabelString, xstr_Dest, NULL);      
         
   XmStringFree(xstr_Dest);
}




sorry if my coding style is noob hehe but really learned a lot from this project :)
thanks in advance jimmer, btw also thanks for posting your hello world using viewkit, really nice!!

_________________
:Octane: (Sakura) :O2: (Sasuke) :1600SW: (Naruto) ... lil Jesse! (O2 laptop)
“Imagination is more important than knowledge.“ – A. Einstein


Top
 Profile  
 
Unread postPosted: Thu Apr 19, 2012 1:09 am 
Offline
User avatar

Joined: Tue Oct 12, 2004 2:54 pm
Posts: 286
Location: London, Ingerlund
Hey there...

So I messed around with your code a little and I got the same 'jump to the left' effect you describe. I recon it's a 'feature' in Motif... Perhaps consider using a manager widget like a Row-Column or a Form as the frame child work-area widget and then do the positioning of your counter inside of that.

J.


Top
 Profile  
 
Unread postPosted: Thu Apr 19, 2012 1:56 am 
Offline
User avatar

Joined: Tue Jul 21, 2009 4:07 am
Posts: 516
Location: Shenzhen, P.R.C
jimmer wrote:
Hey there...

So I messed around with your code a little and I got the same 'jump to the left' effect you describe. I recon it's a 'feature' in Motif... Perhaps consider using a manager widget like a Row-Column or a Form as the frame child work-area widget and then do the positioning of your counter inside of that.

J.

hi jimmer! thanks for trying my code hehe ok will try your idea later then but hmm i kinda change the structure. before, these widgets are under my session shell, but now it belongs to a dialog shell. so i got another question: is it possible to update a label widget owned by a dialog shell? coz i have a case that many dialogs are open with same layout? and i need to update their display with the current count no.

btw, can i ask you email or skype if you don't mind? :) just want to ask some questions

_________________
:Octane: (Sakura) :O2: (Sasuke) :1600SW: (Naruto) ... lil Jesse! (O2 laptop)
“Imagination is more important than knowledge.“ – A. Einstein


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group